Add LoginLimiter to cross-process semaphores

This commit is contained in:
JustArchi
2020-05-20 23:09:27 +02:00
parent 88bb631eea
commit 2b16198f22
2 changed files with 6 additions and 5 deletions

View File

@@ -62,6 +62,7 @@ namespace ArchiSteamFarm {
internal static ICrossProcessSemaphore GiftsSemaphore { get; private set; }
internal static ICrossProcessSemaphore InventorySemaphore { get; private set; }
internal static ICrossProcessSemaphore LoginRateLimitingSemaphore { get; private set; }
internal static ICrossProcessSemaphore LoginSemaphore { get; private set; }
internal static ImmutableDictionary<string, (ICrossProcessSemaphore RateLimitingSemaphore, SemaphoreSlim OpenConnectionsSemaphore)> WebLimitingSemaphores { get; private set; }
private static readonly SemaphoreSlim UpdateSemaphore = new SemaphoreSlim(1, 1);
@@ -147,6 +148,7 @@ namespace ArchiSteamFarm {
GiftsSemaphore ??= OS.CreateCrossProcessSemaphore(nameof(GiftsSemaphore) + webProxyText);
InventorySemaphore ??= OS.CreateCrossProcessSemaphore(nameof(InventorySemaphore) + webProxyText);
LoginRateLimitingSemaphore ??= OS.CreateCrossProcessSemaphore(nameof(LoginRateLimitingSemaphore) + webProxyText);
LoginSemaphore ??= OS.CreateCrossProcessSemaphore(nameof(LoginSemaphore) + webProxyText);
WebLimitingSemaphores ??= new Dictionary<string, (ICrossProcessSemaphore RateLimitingSemaphore, SemaphoreSlim OpenConnectionsSemaphore)>(4, StringComparer.OrdinalIgnoreCase) {
{ nameof(ArchiWebHandler), (OS.CreateCrossProcessSemaphore(nameof(ArchiWebHandler) + webProxyText), new SemaphoreSlim(WebBrowser.MaxConnections, WebBrowser.MaxConnections)) },