From b9c75e73f0d17143e4de3fd26936ca36817d4dee Mon Sep 17 00:00:00 2001 From: Archi Date: Thu, 19 Jan 2023 15:17:47 +0100 Subject: [PATCH] Do a recovery of single depot tasks --- .../SteamTokenDumperPlugin.cs | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs index d5349a582..432a32ec6 100644 --- a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs +++ b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs @@ -430,7 +430,9 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotC if (response.Results == null) { bot.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, ArchiSteamFarm.Localization.Strings.WarningFailedWithError, nameof(response.Results))); - return; + appIDsThisRound.Clear(); + + continue; } bot.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.BotFinishedRetrievingAppInfos, appIDsThisRound.Count)); @@ -465,12 +467,28 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotC } catch (Exception e) { bot.ArchiLogger.LogGenericWarningException(e); - continue; + // We can still do a recovery of tasks one-by-one if possible + results = new List(); + + foreach (Task depotTask in depotTasks.Where(static task => task.Status != TaskStatus.Faulted)) { + try { + SteamApps.DepotKeyCallback result = await depotTask.ConfigureAwait(false); + + results.Add(result); + } catch { + // We don't care anymore, already signalized the problem + } + } } - bot.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.BotFinishedRetrievingDepotKeys, depotTasks.Count)); + bot.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.BotFinishedRetrievingDepotKeys, results.Count)); GlobalCache.UpdateDepotKeys(results); + + if (results.Count < depotTasks.Count) { + // We're not going to record app change numbers, as we didn't fetch all the depot keys we wanted + continue; + } } GlobalCache.UpdateAppChangeNumbers(appChangeNumbers);