From 6edf62d84900280deb5ffa64555f083daed9fc8a Mon Sep 17 00:00:00 2001 From: Archi Date: Thu, 10 Mar 2022 12:36:31 +0100 Subject: [PATCH] Set initial state of ShouldResumeFarming to false ShouldResumeFarming indicates whether call to Resume() should start farming, which is used for example when account is marked as free to farm due to event. That event by default is triggered on ASF startup as well. At the same time, the prerequisite to start farming is having our cache ready at least for the bot that is about to start farming. This happens in OnBotLicenseList() which notified CardsFarmer about new games added once it finishes, which also triggers the farming. Previous behaviour resulted in a bit unwanted situation where CardsFarmer didn't bother waiting for cache to be ready, as the event about occupation triggered resume process, and that process due to true value started immediately. Changing default state of that value to false should suffice, as initial resume event won't cause the cards farming process to be started, and event about new games added already sets that flag back to true, so if cache being rebuilt happens before playing lock being released, Resume() should still trigger farming as wanted. Give yourself a pat on the back if you understood something from that. --- ArchiSteamFarm/Steam/Cards/CardsFarmer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArchiSteamFarm/Steam/Cards/CardsFarmer.cs b/ArchiSteamFarm/Steam/Cards/CardsFarmer.cs index 9587881b3..291487a73 100644 --- a/ArchiSteamFarm/Steam/Cards/CardsFarmer.cs +++ b/ArchiSteamFarm/Steam/Cards/CardsFarmer.cs @@ -144,7 +144,7 @@ public sealed class CardsFarmer : IAsyncDisposable { private bool KeepFarming; private bool ParsingScheduled; private bool PermanentlyPaused; - private bool ShouldResumeFarming = true; + private bool ShouldResumeFarming; internal CardsFarmer(Bot bot) { Bot = bot ?? throw new ArgumentNullException(nameof(bot)); @@ -291,7 +291,7 @@ public sealed class CardsFarmer : IAsyncDisposable { internal void SetInitialState(bool paused) { PermanentlyPaused = Paused = paused; - ShouldResumeFarming = true; + ShouldResumeFarming = false; } internal async Task StartFarming() {