Skip to content

Commit

Permalink
Avoid possible steam network fuckups
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Nov 22, 2015
1 parent fc49e8f commit 3e34fab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ArchiSteamFarm/CardsFarmer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
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);
Expand Down Expand Up @@ -303,8 +304,9 @@ internal class CardsFarmer {
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;
Expand Down

0 comments on commit 3e34fab

Please sign in to comment.