From 265d869b58e43da788ac380c22fce987fa6c15d0 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Tue, 31 Jan 2017 21:37:34 +0100 Subject: [PATCH] Looks like fixed, add auto-cleanup for IgnoredAppIDs --- ArchiSteamFarm/CardsFarmer.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/ArchiSteamFarm/CardsFarmer.cs b/ArchiSteamFarm/CardsFarmer.cs index 982a7f26b..e82b80cef 100755 --- a/ArchiSteamFarm/CardsFarmer.cs +++ b/ArchiSteamFarm/CardsFarmer.cs @@ -23,6 +23,7 @@ */ using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -36,8 +37,9 @@ using Newtonsoft.Json; namespace ArchiSteamFarm { internal sealed class CardsFarmer : IDisposable { private const byte HoursToBump = 2; // How many hours are required for restricted accounts + private const byte HoursToIgnore = 24; // How many hours we ignore unreleased appIDs and don't bother checking them again - private static readonly ConcurrentHashSet IgnoredAppIDs = new ConcurrentHashSet(); // Reserved for unreleased games + private static readonly ConcurrentDictionary IgnoredAppIDs = new ConcurrentDictionary(); // Reserved for unreleased games private static readonly HashSet UntrustedAppIDs = new HashSet { 440, 570, 730 }; [JsonProperty] @@ -336,11 +338,22 @@ namespace ArchiSteamFarm { continue; } - if (IgnoredAppIDs.Contains(appID) || GlobalConfig.GlobalBlacklist.Contains(appID) || Program.GlobalConfig.Blacklist.Contains(appID)) { + if (GlobalConfig.GlobalBlacklist.Contains(appID) || Program.GlobalConfig.Blacklist.Contains(appID)) { // We have this appID blacklisted, so skip it continue; } + DateTime lastPICSReport; + if (IgnoredAppIDs.TryGetValue(appID, out lastPICSReport)) { + if (lastPICSReport.AddHours(HoursToIgnore) < DateTime.UtcNow) { + // This game served its time as being ignored + IgnoredAppIDs.TryRemove(appID, out lastPICSReport); + } else { + // This game is still ignored + continue; + } + } + // Cards HtmlNode progressNode = htmlNode.SelectSingleNode(".//span[@class='progress_info_bold']"); if (progressNode == null) { @@ -540,7 +553,7 @@ namespace ArchiSteamFarm { keepFarming = await ShouldFarm(game).ConfigureAwait(false); } } else { - IgnoredAppIDs.Add(game.AppID); + IgnoredAppIDs[game.AppID] = DateTime.UtcNow; Bot.ArchiLogger.LogGenericInfo(string.Format(Strings.IdlingGameNotReleasedYet, game.AppID, game.GameName)); }