Skip to content

Commit 1a19145

Browse files
committed
Fix !2faok with many confirmations
1 parent 449e4f9 commit 1a19145

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ArchiSteamFarm/Bot.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@ internal async Task AcceptConfirmations(bool accept, Steam.ConfirmationDetails.E
261261
}
262262

263263
if ((acceptedSteamID != 0) || ((acceptedTradeIDs != null) && (acceptedTradeIDs.Count > 0))) {
264-
List<Task<Steam.ConfirmationDetails>> detailsTasks = confirmations.Select(BotDatabase.MobileAuthenticator.GetConfirmationDetails).ToList();
265-
Steam.ConfirmationDetails[] detailsResults = await Task.WhenAll(detailsTasks).ConfigureAwait(false);
264+
List<Task<Steam.ConfirmationDetails>> tasks = confirmations.Select(BotDatabase.MobileAuthenticator.GetConfirmationDetails).ToList();
265+
Steam.ConfirmationDetails[] detailsResults = await Task.WhenAll(tasks).ConfigureAwait(false);
266266

267267
HashSet<uint> ignoredConfirmationIDs = new HashSet<uint>();
268268
foreach (Steam.ConfirmationDetails details in detailsResults.Where(details => (details != null) && (
@@ -282,8 +282,11 @@ internal async Task AcceptConfirmations(bool accept, Steam.ConfirmationDetails.E
282282
}
283283
}
284284

285-
List<Task<bool>> tasks = confirmations.Select(confirmation => BotDatabase.MobileAuthenticator.HandleConfirmation(confirmation, accept)).ToList();
286-
await Task.WhenAll(tasks).ConfigureAwait(false);
285+
// This could be done in parallel, but for some reason Steam allows only one confirmation being accepted at the time
286+
// Therefore, even though no physical barrier stops us from doing so, we execute this synchronously
287+
foreach (MobileAuthenticator.Confirmation confirmation in confirmations) {
288+
await BotDatabase.MobileAuthenticator.HandleConfirmation(confirmation, accept).ConfigureAwait(false);
289+
}
287290
}
288291

289292
internal async Task<bool> RefreshSession() {

0 commit comments

Comments
 (0)