[backend] Use SemaphorePlus instead of SemaphoreSlim
This commit is contained in:
parent
7ea2f71abe
commit
c7d0280eb6
2 changed files with 3 additions and 2 deletions
|
@ -25,7 +25,7 @@ public sealed class WebSocketConnection(
|
||||||
{
|
{
|
||||||
private readonly WriteLockingList<string> _blockedBy = [];
|
private readonly WriteLockingList<string> _blockedBy = [];
|
||||||
private readonly WriteLockingList<string> _blocking = [];
|
private readonly WriteLockingList<string> _blocking = [];
|
||||||
private readonly SemaphoreSlim _lock = new(1);
|
private readonly SemaphorePlus _lock = new(1);
|
||||||
private readonly WriteLockingList<string> _muting = [];
|
private readonly WriteLockingList<string> _muting = [];
|
||||||
public readonly List<IChannel> Channels = [];
|
public readonly List<IChannel> Channels = [];
|
||||||
public readonly EventService EventService = eventSvc;
|
public readonly EventService EventService = eventSvc;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Iceshrimp.Backend.Core.Configuration;
|
using Iceshrimp.Backend.Core.Configuration;
|
||||||
|
using Iceshrimp.Backend.Core.Helpers;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
namespace Iceshrimp.Backend.Core.Middleware;
|
namespace Iceshrimp.Backend.Core.Middleware;
|
||||||
|
@ -9,7 +10,7 @@ public class FederationSemaphoreMiddleware(
|
||||||
IHostApplicationLifetime appLifetime
|
IHostApplicationLifetime appLifetime
|
||||||
) : IMiddleware
|
) : 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)
|
public async Task InvokeAsync(HttpContext ctx, RequestDelegate next)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue