release semaphore only if requied
This commit is contained in:
@@ -100,13 +100,14 @@ public class ApiServer(string apiUrl) : IApiServer
|
||||
{
|
||||
if (MaxConcurentConnections == int.MaxValue)
|
||||
return; // Unlimited in this case
|
||||
semaphore ??= new(MaxConcurentConnections);
|
||||
semaphore ??= new(MaxConcurentConnections, MaxConcurentConnections);
|
||||
semaphore.Wait();
|
||||
}
|
||||
|
||||
protected virtual void FreeSlot()
|
||||
{
|
||||
semaphore?.Release();
|
||||
if (semaphore != null && semaphore.CurrentCount < MaxConcurentConnections)
|
||||
semaphore.Release();
|
||||
}
|
||||
|
||||
public virtual void RegisterHandler<T>(T instance) where T : class
|
||||
|
||||
Reference in New Issue
Block a user