mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
Misc
This commit is contained in:
@@ -40,7 +40,7 @@ namespace ArchiSteamFarm.Collections {
|
||||
|
||||
BackingMaxCount = value;
|
||||
|
||||
while ((BackingQueue.Count > MaxCount) && BackingQueue.TryDequeue(out _)) { }
|
||||
Resize();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,11 +60,17 @@ namespace ArchiSteamFarm.Collections {
|
||||
internal void Enqueue(T obj) {
|
||||
BackingQueue.Enqueue(obj);
|
||||
|
||||
Resize();
|
||||
}
|
||||
|
||||
private void Resize() {
|
||||
if (BackingQueue.Count <= MaxCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
BackingQueue.TryDequeue(out _);
|
||||
lock (BackingQueue) {
|
||||
while ((BackingQueue.Count > MaxCount) && BackingQueue.TryDequeue(out _)) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user