diff --git a/Iceshrimp.Backend/Controllers/Mastodon/Streaming/WebSocketConnection.cs b/Iceshrimp.Backend/Controllers/Mastodon/Streaming/WebSocketConnection.cs index 5efa99b9..f9cd9f7b 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/Streaming/WebSocketConnection.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/Streaming/WebSocketConnection.cs @@ -25,7 +25,7 @@ public sealed class WebSocketConnection( { private readonly WriteLockingList _blockedBy = []; private readonly WriteLockingList _blocking = []; - private readonly SemaphoreSlim _lock = new(1); + private readonly SemaphorePlus _lock = new(1); private readonly WriteLockingList _muting = []; public readonly List Channels = []; public readonly EventService EventService = eventSvc; diff --git a/Iceshrimp.Backend/Core/Middleware/FederationSemaphoreMiddleware.cs b/Iceshrimp.Backend/Core/Middleware/FederationSemaphoreMiddleware.cs index b96bd922..df23d0c4 100644 --- a/Iceshrimp.Backend/Core/Middleware/FederationSemaphoreMiddleware.cs +++ b/Iceshrimp.Backend/Core/Middleware/FederationSemaphoreMiddleware.cs @@ -1,5 +1,6 @@ using System.Net; using Iceshrimp.Backend.Core.Configuration; +using Iceshrimp.Backend.Core.Helpers; using Microsoft.Extensions.Options; namespace Iceshrimp.Backend.Core.Middleware; @@ -9,7 +10,7 @@ public class FederationSemaphoreMiddleware( IHostApplicationLifetime appLifetime ) : IMiddleware { - private readonly SemaphoreSlim _semaphore = new(config.Value.FederationRequestHandlerConcurrency); + private readonly SemaphorePlus _semaphore = new(Math.Max(config.Value.FederationRequestHandlerConcurrency, 1)); public async Task InvokeAsync(HttpContext ctx, RequestDelegate next) {