Skip to content

Commit

Permalink
SemaphoreSlim bug
Browse files Browse the repository at this point in the history
  • Loading branch information
trueai-org committed Aug 23, 2024
1 parent 49b116f commit 318ab4c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Midjourney.Infrastructure/WebSocketManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,18 @@ public async Task<bool> StartAsync(bool reconnect = false)
}
finally
{
if (_stateLock.CurrentCount < _stateLock.Release(1))
try
{
_stateLock.Release();
}
else
catch (SemaphoreFullException)
{
_logger.Warning("Skipping _stateLock.Release() as the semaphore is already at max count. {@0}", Account.ChannelId);
}
catch (Exception ex)
{
_logger.Error(ex, "_stateLock Release 异常 {@0}", Account.ChannelId);
}
}

return false;
Expand Down

0 comments on commit 318ab4c

Please sign in to comment.