mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-12 19:47:21 +01:00
fix bug, again
This commit is contained in:
parent
5754fdf5bc
commit
3ff75db0f2
1 changed files with 3 additions and 3 deletions
|
|
@ -10,7 +10,7 @@ public sealed class ConcurrencyFilter : IHubFilter, IDisposable
|
||||||
private SemaphoreSlim _limiter;
|
private SemaphoreSlim _limiter;
|
||||||
private int _setLimit = 0;
|
private int _setLimit = 0;
|
||||||
private readonly IConfigurationService<ServerConfiguration> _config;
|
private readonly IConfigurationService<ServerConfiguration> _config;
|
||||||
private readonly CancellationTokenSource _cancellationToken;
|
private readonly CancellationTokenSource _cts = new();
|
||||||
|
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
|
|
||||||
|
|
@ -23,7 +23,7 @@ public sealed class ConcurrencyFilter : IHubFilter, IDisposable
|
||||||
|
|
||||||
_ = Task.Run(async () =>
|
_ = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
var token = _cancellationToken.Token;
|
var token = _cts.Token;
|
||||||
while (!token.IsCancellationRequested)
|
while (!token.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
mareMetrics.SetGaugeTo(MetricsAPI.GaugeHubConcurrency, _limiter?.CurrentCount ?? 0);
|
mareMetrics.SetGaugeTo(MetricsAPI.GaugeHubConcurrency, _limiter?.CurrentCount ?? 0);
|
||||||
|
|
@ -71,7 +71,7 @@ public sealed class ConcurrencyFilter : IHubFilter, IDisposable
|
||||||
}
|
}
|
||||||
|
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
_cancellationToken.Cancel();
|
_cts.Cancel();
|
||||||
_config.ConfigChangedEvent -= OnConfigChange;
|
_config.ConfigChangedEvent -= OnConfigChange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue