From 34b3c5a671341953b8bf9de1578b212bc02db03c Mon Sep 17 00:00:00 2001 From: barelyprofessional <150058423+barelyprofessional@users.noreply.github.com> Date: Tue, 10 Feb 2026 22:57:44 -0600 Subject: [PATCH] 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 --- KfChatDotNetBot/ChatBot.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/KfChatDotNetBot/ChatBot.cs b/KfChatDotNetBot/ChatBot.cs index b37e39d..3cc9865 100644 --- a/KfChatDotNetBot/ChatBot.cs +++ b/KfChatDotNetBot/ChatBot.cs @@ -171,6 +171,9 @@ public class ChatBot _logger.Error($"inactivityTime -> {inactivityTime:g}"); _logger.Error($"deadTime -> {deadTime:g}"); 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"); RefreshXfToken().Wait(_cancellationToken); } - - if (disconnectionInfo.Type == DisconnectionType.ByUser) return; - _logger.Info("Forcing reconnect"); - KfClient.StartWsClient().Wait(_cancellationToken); } private void OnKfWsReconnected(object sender, ReconnectionInfo reconnectionInfo)