From 3e34fabfaf0ea865e034c6734c5392ba4387a66a Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sun, 22 Nov 2015 01:22:45 +0100 Subject: [PATCH] Avoid possible steam network fuckups --- ArchiSteamFarm/CardsFarmer.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ArchiSteamFarm/CardsFarmer.cs b/ArchiSteamFarm/CardsFarmer.cs index 2d8727ffd..a53a4c5de 100755 --- a/ArchiSteamFarm/CardsFarmer.cs +++ b/ArchiSteamFarm/CardsFarmer.cs @@ -33,6 +33,7 @@ using System.Threading.Tasks; namespace ArchiSteamFarm { internal class CardsFarmer { private const byte StatusCheckSleep = 5; // In minutes, how long to wait before checking the appID again + private const ushort MaxFarmingTime = 300; // In minutes, how long ASF is allowed to farm one game in solo mode private readonly ManualResetEvent FarmResetEvent = new ManualResetEvent(false); private readonly SemaphoreSlim Semaphore = new SemaphoreSlim(1); @@ -303,8 +304,9 @@ namespace ArchiSteamFarm { Bot.ArchiHandler.PlayGames(appID); bool success = true; + bool? keepFarming = await ShouldFarm(appID).ConfigureAwait(false); - while (keepFarming == null || keepFarming.Value) { + for (ushort farmingTime = 0; farmingTime <= MaxFarmingTime && (!keepFarming.HasValue || keepFarming.Value); farmingTime += StatusCheckSleep) { Logging.LogGenericInfo(Bot.BotName, "Still farming: " + appID); if (FarmResetEvent.WaitOne(1000 * 60 * StatusCheckSleep)) { success = false;