mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Uber aggressive reconnection logic was glitching out like mad. Added a reconnect on dead bot detection and reduced inactivity timeout to 45 seconds in settings for the bot
This commit is contained in:
@@ -171,6 +171,9 @@ public class ChatBot
|
|||||||
_logger.Error($"inactivityTime -> {inactivityTime:g}");
|
_logger.Error($"inactivityTime -> {inactivityTime:g}");
|
||||||
_logger.Error($"deadTime -> {deadTime:g}");
|
_logger.Error($"deadTime -> {deadTime:g}");
|
||||||
if (shouldExit) Environment.Exit(1);
|
if (shouldExit) Environment.Exit(1);
|
||||||
|
_logger.Error("Since we didn't exit, let's try forcing a connection");
|
||||||
|
await KfClient.DisconnectAsync();
|
||||||
|
await KfClient.StartWsClient();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -657,10 +660,6 @@ public class ChatBot
|
|||||||
_logger.Info("Chat 203'd, getting a new token");
|
_logger.Info("Chat 203'd, getting a new token");
|
||||||
RefreshXfToken().Wait(_cancellationToken);
|
RefreshXfToken().Wait(_cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disconnectionInfo.Type == DisconnectionType.ByUser) return;
|
|
||||||
_logger.Info("Forcing reconnect");
|
|
||||||
KfClient.StartWsClient().Wait(_cancellationToken);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnKfWsReconnected(object sender, ReconnectionInfo reconnectionInfo)
|
private void OnKfWsReconnected(object sender, ReconnectionInfo reconnectionInfo)
|
||||||
|
|||||||
Reference in New Issue
Block a user