Improve .NET 9.0+ locking performance (#3216)

This commit is contained in:
Mark Cilia Vincenti
2025-12-30 20:08:44 +01:00
committed by GitHub
parent fd6e3ad8df
commit 4e95dd7123
14 changed files with 31 additions and 16 deletions

View File

@@ -17,7 +17,7 @@ namespace Discord.Net.Queue
{
private const int MinimumSleepTimeMs = 750;
private readonly object _lock;
private readonly Lock _lock;
private readonly RequestQueue _queue;
private int _semaphore;
private DateTimeOffset? _resetTick;
@@ -32,7 +32,7 @@ namespace Discord.Net.Queue
_queue = queue;
Id = id;
_lock = new object();
_lock = new();
if (request.Options.IsClientBucket)
WindowCount = ClientBucket.Get(request.Options.BucketId).WindowCount;