mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
Improve concurrent entries further
This commit is contained in:
@@ -65,6 +65,8 @@ namespace ArchiSteamFarm {
|
||||
private static readonly SemaphoreSlim LoginRateLimitingSemaphore = new SemaphoreSlim(1, 1);
|
||||
private static readonly SemaphoreSlim LoginSemaphore = new SemaphoreSlim(1, 1);
|
||||
|
||||
private static bool LoginRateLimited;
|
||||
|
||||
[JsonIgnore]
|
||||
[PublicAPI]
|
||||
public readonly Actions Actions;
|
||||
@@ -2081,13 +2083,24 @@ namespace ArchiSteamFarm {
|
||||
case EResult.RateLimitExceeded:
|
||||
ArchiLogger.LogGenericInfo(string.Format(Strings.BotRateLimitExceeded, TimeSpan.FromMinutes(LoginCooldownInMinutes).ToHumanReadable()));
|
||||
|
||||
if (await LoginRateLimitingSemaphore.WaitAsync(WebBrowser.MaxTries * 1000).ConfigureAwait(false)) {
|
||||
Utilities.InBackground(
|
||||
async () => {
|
||||
await Task.Delay(LoginCooldownInMinutes * 60 * 1000).ConfigureAwait(false);
|
||||
LoginRateLimitingSemaphore.Release();
|
||||
}
|
||||
);
|
||||
if (LoginRateLimited) {
|
||||
break;
|
||||
}
|
||||
|
||||
await LoginRateLimitingSemaphore.WaitAsync().ConfigureAwait(false);
|
||||
|
||||
try {
|
||||
if (LoginRateLimited) {
|
||||
break;
|
||||
}
|
||||
|
||||
LoginRateLimited = true;
|
||||
|
||||
await Task.Delay(LoginCooldownInMinutes * 60 * 1000).ConfigureAwait(false);
|
||||
|
||||
LoginRateLimited = false;
|
||||
} finally {
|
||||
LoginRateLimitingSemaphore.Release();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user