This commit is contained in:
JustArchi
2022-10-28 19:08:14 +02:00
parent 17563149b6
commit e2f3975305
3 changed files with 8 additions and 4 deletions

View File

@@ -42,7 +42,7 @@ using ArchiSteamFarm.Web;
namespace ArchiSteamFarm.Core;
internal sealed class RemoteCommunication : IAsyncDisposable, IDisposable {
private const ushort MaxItemsForFairBots = ArchiWebHandler.MaxItemsInSingleInventoryRequest * WebBrowser.MaxTries; // Determines which fair bots we'll deprioritize when matching due to excessive number of inventory requests they need to make, which are likely to fail in the process or cause excessive delays
private const ushort MaxItemsForFairBots = ArchiWebHandler.RecommendedItemsInSingleInventoryRequest * WebBrowser.MaxTries; // Determines which fair bots we'll deprioritize when matching due to excessive number of inventory requests they need to make, which are likely to fail in the process or cause excessive delays
private const byte MaxMatchedBotsHard = 40; // Determines how many bots we can attempt to match in total, where match attempt is equal to analyzing bot's inventory
private const byte MaxMatchingRounds = 10; // Determines maximum amount of matching rounds we're going to consider before leaving the rest of work for the next batch
private const byte MinAnnouncementCheckTTL = 6; // Minimum amount of hours we must wait before checking eligibility for Announcement, should be lower than MinPersonaStateTTL

View File

@@ -48,10 +48,11 @@ using SteamKit2;
namespace ArchiSteamFarm.Steam.Integration;
public sealed class ArchiWebHandler : IDisposable {
internal const ushort MaxItemsInSingleInventoryRequest = 2000;
internal const ushort RecommendedItemsInSingleInventoryRequest = 2000; // In regards to rate limits
private const string EconService = "IEconService";
private const string LoyaltyRewardsService = "ILoyaltyRewardsService";
private const ushort MaxItemsInSingleInventoryRequest = 5000;
private const byte MinimumSessionValidityInSeconds = 10;
private const string SteamAppsService = "ISteamApps";
private const string SteamUserAuthService = "ISteamUserAuth";
@@ -135,6 +136,8 @@ public sealed class ArchiWebHandler : IDisposable {
throw new InvalidOperationException(nameof(ASF.InventorySemaphore));
}
ushort count = RecommendedItemsInSingleInventoryRequest;
if (steamID == 0) {
if (!Initialized) {
byte connectionTimeout = ASF.GlobalConfig?.ConnectionTimeout ?? GlobalConfig.DefaultConnectionTimeout;
@@ -149,6 +152,7 @@ public sealed class ArchiWebHandler : IDisposable {
}
steamID = Bot.SteamID;
count = MaxItemsInSingleInventoryRequest;
} else if (!new SteamID(steamID).IsIndividualAccount) {
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, Strings.ErrorObjectIsNull, nameof(steamID)));
}
@@ -161,7 +165,7 @@ public sealed class ArchiWebHandler : IDisposable {
int rateLimitingDelay = (ASF.GlobalConfig?.InventoryLimiterDelay ?? GlobalConfig.DefaultInventoryLimiterDelay) * 1000;
while (true) {
Uri request = new(SteamCommunityURL, $"/inventory/{steamID}/{appID}/{contextID}?count={MaxItemsInSingleInventoryRequest}&l=english{(startAssetID > 0 ? $"&start_assetid={startAssetID}" : "")}");
Uri request = new(SteamCommunityURL, $"/inventory/{steamID}/{appID}/{contextID}?count={count}&l=english{(startAssetID > 0 ? $"&start_assetid={startAssetID}" : "")}");
await ASF.InventorySemaphore.WaitAsync().ConfigureAwait(false);

View File

@@ -73,7 +73,7 @@ public sealed class GlobalConfig {
public const byte DefaultIdleFarmingPeriod = 8;
[PublicAPI]
public const byte DefaultInventoryLimiterDelay = 3;
public const byte DefaultInventoryLimiterDelay = 4;
[PublicAPI]
public const bool DefaultIPC = true;