From fd05a2cab6f04646df0c8c28dc0e1d987064bcd7 Mon Sep 17 00:00:00 2001 From: Archi Date: Tue, 28 Dec 2021 23:44:12 +0100 Subject: [PATCH] Misc I can imagine a very narrow edge case when waiting task would return just as the previous task releases the semaphore. This delay will prevent this from happening. --- ArchiSteamFarm/Steam/Bot.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArchiSteamFarm/Steam/Bot.cs b/ArchiSteamFarm/Steam/Bot.cs index 326a6779c..dec00edb5 100644 --- a/ArchiSteamFarm/Steam/Bot.cs +++ b/ArchiSteamFarm/Steam/Bot.cs @@ -1893,8 +1893,8 @@ public sealed class Bot : IAsyncDisposable { return result; } - private void HandleCallbacks() { - if (!CallbackSemaphore.Wait(0)) { + private async Task HandleCallbacks() { + if (!await CallbackSemaphore.WaitAsync(CallbackSleep)) { if (Debugging.IsUserDebugging) { ArchiLogger.LogGenericDebug(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, nameof(CallbackSemaphore))); }