Revert recent confirmations rate-limiting, add debug

This commit is contained in:
JustArchi
2016-07-29 22:34:52 +02:00
parent ef5b108b34
commit 07af05ad00
2 changed files with 8 additions and 21 deletions

View File

@@ -25,7 +25,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
@@ -56,7 +55,6 @@ namespace ArchiSteamFarm {
private const byte CodeDigits = 5;
private const byte CodeInterval = 30;
private const byte MaxConfirmationsPerRequest = 5; // This is limit enforced by Valve - using higher number might result in likeness of requests failing
private static readonly char[] CodeCharacters = {
'2', '3', '4', '5', '6', '7', '8', '9', 'B', 'C',
@@ -117,28 +115,12 @@ namespace ArchiSteamFarm {
}
string confirmationHash = GenerateConfirmationKey(time, "conf");
if (string.IsNullOrEmpty(confirmationHash)) {
Logging.LogNullError(nameof(confirmationHash), Bot.BotName);
return false;
}
if (confirmations.Count <= MaxConfirmationsPerRequest) {
if (!string.IsNullOrEmpty(confirmationHash)) {
return await Bot.ArchiWebHandler.HandleConfirmations(DeviceID, confirmationHash, time, confirmations, accept).ConfigureAwait(false);
}
HashSet<Confirmation> pendingConfirmations = new HashSet<Confirmation>(confirmations);
do {
HashSet<Confirmation> currentConfirmations = new HashSet<Confirmation>(pendingConfirmations.Take(MaxConfirmationsPerRequest));
if (!await Bot.ArchiWebHandler.HandleConfirmations(DeviceID, confirmationHash, time, currentConfirmations, accept).ConfigureAwait(false)) {
return false;
}
pendingConfirmations.ExceptWith(currentConfirmations);
} while (pendingConfirmations.Count > 0);
return true;
Logging.LogNullError(nameof(confirmationHash), Bot.BotName);
return false;
}
internal async Task<Steam.ConfirmationDetails> GetConfirmationDetails(Confirmation confirmation) {