mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-14 02:14:15 +01:00
adjust grabbing all keys from redis on the shards
This commit is contained in:
parent
f37fee3235
commit
db2d0451ca
1 changed files with 34 additions and 25 deletions
|
|
@ -36,12 +36,16 @@ public class SystemInfoService : IHostedService, IDisposable
|
||||||
{
|
{
|
||||||
_logger.LogInformation("System Info Service started");
|
_logger.LogInformation("System Info Service started");
|
||||||
|
|
||||||
_timer = new Timer(PushSystemInfo, null, TimeSpan.Zero, TimeSpan.FromSeconds(5));
|
var timeOut = _config.IsMain ? 5 : 15;
|
||||||
|
|
||||||
|
_timer = new Timer(PushSystemInfo, null, TimeSpan.Zero, TimeSpan.FromSeconds(timeOut));
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PushSystemInfo(object state)
|
private void PushSystemInfo(object state)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
ThreadPool.GetAvailableThreads(out int workerThreads, out int ioThreads);
|
ThreadPool.GetAvailableThreads(out int workerThreads, out int ioThreads);
|
||||||
|
|
||||||
|
|
@ -72,6 +76,11 @@ public class SystemInfoService : IHostedService, IDisposable
|
||||||
_mareMetrics.SetGaugeTo(MetricsAPI.GaugeUsersRegistered, db.Users.AsNoTracking().Count());
|
_mareMetrics.SetGaugeTo(MetricsAPI.GaugeUsersRegistered, db.Users.AsNoTracking().Count());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "Failed to push system info");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Task StopAsync(CancellationToken cancellationToken)
|
public Task StopAsync(CancellationToken cancellationToken)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue