From 1c97fd915033eb6679d92d55467d16e9f8a10e68 Mon Sep 17 00:00:00 2001 From: rootdarkarchon Date: Sun, 14 Jan 2024 21:24:12 +0100 Subject: [PATCH] do not use async for queue processing --- .../Services/RequestQueueService.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MareSynchronosServer/MareSynchronosStaticFilesServer/Services/RequestQueueService.cs b/MareSynchronosServer/MareSynchronosStaticFilesServer/Services/RequestQueueService.cs index ed84d40..c17abc7 100644 --- a/MareSynchronosServer/MareSynchronosStaticFilesServer/Services/RequestQueueService.cs +++ b/MareSynchronosServer/MareSynchronosStaticFilesServer/Services/RequestQueueService.cs @@ -116,14 +116,14 @@ public class RequestQueueService : IHostedService return Task.CompletedTask; } - private async Task DequeueIntoSlotAsync(UserRequest userRequest, int slot) + private void DequeueIntoSlot(UserRequest userRequest, int slot) { _logger.LogDebug("Dequeueing {req} into {i}: {user} with {file}", userRequest.RequestId, slot, userRequest.User, string.Join(", ", userRequest.FileIds)); _userQueueRequests[slot] = new(userRequest, DateTime.UtcNow.AddSeconds(_queueExpirationSeconds)); - await _hubContext.Clients.User(userRequest.User).SendAsync(nameof(IMareHub.Client_DownloadReady), userRequest.RequestId).ConfigureAwait(false); + _ = _hubContext.Clients.User(userRequest.User).SendAsync(nameof(IMareHub.Client_DownloadReady), userRequest.RequestId).ConfigureAwait(false); } - private async void ProcessQueue(object src, ElapsedEventArgs e) + private void ProcessQueue(object src, ElapsedEventArgs e) { _logger.LogDebug("Periodic Processing Queue Start"); _metrics.SetGaugeTo(MetricsAPI.GaugeQueueFree, _userQueueRequests.Count(c => c == null)); @@ -140,7 +140,7 @@ public class RequestQueueService : IHostedService return; } - await _queueProcessingSemaphore.WaitAsync().ConfigureAwait(false); + _queueProcessingSemaphore.Wait(); try { @@ -171,7 +171,7 @@ public class RequestQueueService : IHostedService { if (prioRequest.IsCancelled) continue; - await DequeueIntoSlotAsync(prioRequest, i).ConfigureAwait(false); + DequeueIntoSlot(prioRequest, i); break; } @@ -179,7 +179,7 @@ public class RequestQueueService : IHostedService { if (request.IsCancelled) continue; - await DequeueIntoSlotAsync(request, i).ConfigureAwait(false); + DequeueIntoSlot(request, i); break; }