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:
barelyprofessional
2026-02-10 22:57:44 -06:00
parent 3d99cce5fb
commit 34b3c5a671

View File

@@ -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)