From 0c3dfaa4ae79a0940d8af142598d28a0d51fe493 Mon Sep 17 00:00:00 2001 From: Archi Date: Mon, 21 Mar 2022 14:50:36 +0100 Subject: [PATCH] Use generic delay for all unhandled disconnects There are only handful of cases where we want to reconnect immediately, and login limiter delay usually kills those anyway --- ArchiSteamFarm/Steam/Bot.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/ArchiSteamFarm/Steam/Bot.cs b/ArchiSteamFarm/Steam/Bot.cs index 0b3508845..6732788ce 100644 --- a/ArchiSteamFarm/Steam/Bot.cs +++ b/ArchiSteamFarm/Steam/Bot.cs @@ -2384,18 +2384,10 @@ public sealed class Bot : IAsyncDisposable { // Do not attempt to reconnect, those failures are permanent return; case EResult.InvalidPassword when !string.IsNullOrEmpty(BotDatabase.LoginKey): + // We can retry immediately BotDatabase.LoginKey = null; ArchiLogger.LogGenericInfo(Strings.BotRemovedExpiredLoginKey); - break; - case EResult.InvalidPassword: - case EResult.NoConnection: - case EResult.ServiceUnavailable: - case EResult.Timeout: - case EResult.TryAnotherCM: - case EResult.TwoFactorCodeMismatch: - await Task.Delay(5000).ConfigureAwait(false); - break; case EResult.RateLimitExceeded: ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.BotRateLimitExceeded, TimeSpan.FromMinutes(LoginCooldownInMinutes).ToHumanReadable())); @@ -2410,6 +2402,11 @@ public sealed class Bot : IAsyncDisposable { ASF.LoginRateLimitingSemaphore.Release(); } + break; + default: + // Generic delay before retrying + await Task.Delay(5000).ConfigureAwait(false); + break; }