mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-23 01:38:36 +00:00
Closes #605
This commit is contained in:
@@ -50,11 +50,13 @@ namespace ArchiSteamFarm {
|
||||
private const ushort MaxSteamMessageLength = 2048;
|
||||
private const byte MaxTwoFactorCodeFailures = 3;
|
||||
private const byte MinHeartBeatTTL = GlobalConfig.DefaultConnectionTimeout; // Assume client is responsive for at least that amount of seconds
|
||||
private const byte PICSCooldownInMiliseconds = 200; // We might need to tune this further
|
||||
|
||||
internal static readonly ConcurrentDictionary<string, Bot> Bots = new ConcurrentDictionary<string, Bot>();
|
||||
|
||||
private static readonly SemaphoreSlim GiftsSemaphore = new SemaphoreSlim(1);
|
||||
private static readonly SemaphoreSlim LoginSemaphore = new SemaphoreSlim(1);
|
||||
private static readonly SemaphoreSlim PICSSemaphore = new SemaphoreSlim(1);
|
||||
private static readonly SteamConfiguration SteamConfiguration = new SteamConfiguration();
|
||||
|
||||
internal readonly ArchiLogger ArchiLogger;
|
||||
@@ -347,6 +349,8 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
await LimitPICSRequestsAsync().ConfigureAwait(false);
|
||||
|
||||
AsyncJobMultiple<SteamApps.PICSProductInfoCallback>.ResultSet productInfoResultSet;
|
||||
|
||||
try {
|
||||
@@ -450,6 +454,8 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
internal async Task<Dictionary<uint, HashSet<uint>>> GetAppIDsToPackageIDs(IEnumerable<uint> packageIDs) {
|
||||
await LimitPICSRequestsAsync().ConfigureAwait(false);
|
||||
|
||||
AsyncJobMultiple<SteamApps.PICSProductInfoCallback>.ResultSet productInfoResultSet;
|
||||
|
||||
try {
|
||||
@@ -1380,6 +1386,14 @@ namespace ArchiSteamFarm {
|
||||
}).Forget();
|
||||
}
|
||||
|
||||
private static async Task LimitPICSRequestsAsync() {
|
||||
await PICSSemaphore.WaitAsync().ConfigureAwait(false);
|
||||
Task.Run(async () => {
|
||||
await Task.Delay(PICSCooldownInMiliseconds).ConfigureAwait(false);
|
||||
PICSSemaphore.Release();
|
||||
}).Forget();
|
||||
}
|
||||
|
||||
private async Task MarkInventoryIfNeeded() {
|
||||
if (!BotConfig.DismissInventoryNotifications) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user