From a91a4aada61937c838b434157790a6b69dab711a Mon Sep 17 00:00:00 2001 From: Archi Date: Mon, 23 Jan 2023 11:25:20 +0100 Subject: [PATCH] Fetch main depot key only if we managed to fetch some other ones --- .../SteamTokenDumperPlugin.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs index 019e07628..3c6404df1 100644 --- a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs +++ b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs @@ -451,13 +451,17 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotC foreach (SteamApps.PICSProductInfoCallback.PICSProductInfo app in response.Results.SelectMany(static result => result.Apps.Values)) { appChangeNumbers[app.ID] = app.ChangeNumber; - if (GlobalCache.ShouldRefreshDepotKey(app.ID)) { + foreach (KeyValue depot in app.KeyValues["depots"].Children) { + if (!uint.TryParse(depot.Name, out uint depotID) || Config.SecretDepotIDs.Contains(depotID) || !GlobalCache.ShouldRefreshDepotKey(depotID)) { + continue; + } + depotKeysTotal++; await depotsRateLimitingSemaphore.WaitAsync().ConfigureAwait(false); try { - SteamApps.DepotKeyCallback depotResponse = await bot.SteamApps.GetDepotDecryptionKey(app.ID, app.ID).ToLongRunningTask().ConfigureAwait(false); + SteamApps.DepotKeyCallback depotResponse = await bot.SteamApps.GetDepotDecryptionKey(depotID, app.ID).ToLongRunningTask().ConfigureAwait(false); depotKeysSuccessful++; @@ -477,17 +481,14 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotC } } - foreach (KeyValue depot in app.KeyValues["depots"].Children) { - if (!uint.TryParse(depot.Name, out uint depotID) || Config.SecretDepotIDs.Contains(depotID) || !GlobalCache.ShouldRefreshDepotKey(depotID)) { - continue; - } - + // Consider fetching main appID key only if we've actually considered some new depots for resolving + if ((depotKeysSuccessful > 0) && GlobalCache.ShouldRefreshDepotKey(app.ID)) { depotKeysTotal++; await depotsRateLimitingSemaphore.WaitAsync().ConfigureAwait(false); try { - SteamApps.DepotKeyCallback depotResponse = await bot.SteamApps.GetDepotDecryptionKey(depotID, app.ID).ToLongRunningTask().ConfigureAwait(false); + SteamApps.DepotKeyCallback depotResponse = await bot.SteamApps.GetDepotDecryptionKey(app.ID, app.ID).ToLongRunningTask().ConfigureAwait(false); depotKeysSuccessful++;