mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-14 00:47:25 +00:00
Improve load-balancing
This commit is contained in:
parent
2bd64863c9
commit
abdab30c15
6 changed files with 21 additions and 5 deletions
|
@ -223,7 +223,7 @@ namespace ArchiSteamFarm {
|
|||
HeartBeatTimer = new Timer(
|
||||
async e => await HeartBeat().ConfigureAwait(false),
|
||||
null,
|
||||
TimeSpan.FromMinutes(1) + TimeSpan.FromMinutes(0.2 * Bots.Count), // Delay
|
||||
TimeSpan.FromMinutes(1) + TimeSpan.FromSeconds(Program.LoadBalancingDelay * Bots.Count), // Delay
|
||||
TimeSpan.FromMinutes(1) // Period
|
||||
);
|
||||
}
|
||||
|
@ -1128,7 +1128,7 @@ namespace ArchiSteamFarm {
|
|||
SendItemsTimer = new Timer(
|
||||
async e => await ResponseLoot(steamMasterID).ConfigureAwait(false),
|
||||
null,
|
||||
TimeSpan.FromHours(BotConfig.SendTradePeriod) + TimeSpan.FromMinutes(Bots.Count), // Delay
|
||||
TimeSpan.FromHours(BotConfig.SendTradePeriod) + TimeSpan.FromSeconds(Program.LoadBalancingDelay * Bots.Count), // Delay
|
||||
TimeSpan.FromHours(BotConfig.SendTradePeriod) // Period
|
||||
);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace ArchiSteamFarm {
|
|||
IdleFarmingTimer = new Timer(
|
||||
async e => await CheckGamesForFarming().ConfigureAwait(false),
|
||||
null,
|
||||
TimeSpan.FromHours(Program.GlobalConfig.IdleFarmingPeriod) + TimeSpan.FromMinutes(0.5 * Bot.Bots.Count), // Delay
|
||||
TimeSpan.FromHours(Program.GlobalConfig.IdleFarmingPeriod) + TimeSpan.FromSeconds(Program.LoadBalancingDelay * Bot.Bots.Count), // Delay
|
||||
TimeSpan.FromHours(Program.GlobalConfig.IdleFarmingPeriod) // Period
|
||||
);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace ArchiSteamFarm {
|
|||
[SuppressMessage("ReSharper", "ConvertToConstant.Global")]
|
||||
internal sealed class GlobalConfig {
|
||||
internal const byte DefaultConnectionTimeout = 60;
|
||||
internal const byte DefaultLoginLimiterDelay = 10;
|
||||
internal const ushort DefaultWCFPort = 1242;
|
||||
|
||||
// This is hardcoded blacklist which should not be possible to change
|
||||
|
@ -82,7 +83,7 @@ namespace ArchiSteamFarm {
|
|||
internal readonly byte InventoryLimiterDelay = 3;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal readonly byte LoginLimiterDelay = 10;
|
||||
internal readonly byte LoginLimiterDelay = DefaultLoginLimiterDelay;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal readonly byte MaxFarmingTime = 10;
|
||||
|
|
|
@ -42,6 +42,14 @@ using SteamKit2;
|
|||
namespace ArchiSteamFarm {
|
||||
internal static class Program {
|
||||
internal static bool IsWCFRunning => WCF.IsServerRunning;
|
||||
|
||||
internal static byte LoadBalancingDelay {
|
||||
get {
|
||||
byte result = GlobalConfig?.LoginLimiterDelay ?? GlobalConfig.DefaultLoginLimiterDelay;
|
||||
return result < GlobalConfig.DefaultLoginLimiterDelay ? GlobalConfig.DefaultLoginLimiterDelay : result;
|
||||
}
|
||||
}
|
||||
|
||||
internal static GlobalConfig GlobalConfig { get; private set; }
|
||||
internal static GlobalDatabase GlobalDatabase { get; private set; }
|
||||
internal static bool IsRunningAsService { get; private set; }
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace ArchiSteamFarm {
|
|||
SteamDiscoveryQueueTimer = new Timer(
|
||||
async e => await ExploreDiscoveryQueue().ConfigureAwait(false),
|
||||
null,
|
||||
TimeSpan.FromMinutes(1 + 0.2 * Bot.Bots.Count), // Delay
|
||||
TimeSpan.FromMinutes(1) + TimeSpan.FromSeconds(Program.LoadBalancingDelay * Bot.Bots.Count), // Delay
|
||||
TimeSpan.FromHours(6.1) // Period
|
||||
);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,13 @@ using SteamKit2;
|
|||
|
||||
namespace ArchiSteamFarm {
|
||||
internal static class Program {
|
||||
internal static byte LoadBalancingDelay {
|
||||
get {
|
||||
byte result = GlobalConfig?.LoginLimiterDelay ?? GlobalConfig.DefaultLoginLimiterDelay;
|
||||
return result < GlobalConfig.DefaultLoginLimiterDelay ? GlobalConfig.DefaultLoginLimiterDelay : result;
|
||||
}
|
||||
}
|
||||
|
||||
internal static GlobalConfig GlobalConfig { get; private set; }
|
||||
internal static GlobalDatabase GlobalDatabase { get; private set; }
|
||||
internal static WebBrowser WebBrowser { get; private set; }
|
||||
|
|
Loading…
Reference in a new issue