mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-31 05:03:39 +01:00
fixes etc
This commit is contained in:
parent
2510cce711
commit
74209b3952
7 changed files with 52 additions and 97 deletions
|
|
@ -16,14 +16,16 @@ namespace MareSynchronosServer;
|
|||
|
||||
public class SystemInfoService : IHostedService, IDisposable
|
||||
{
|
||||
private readonly MetricsService.MetricsServiceClient metricsClient;
|
||||
private readonly IServiceProvider _services;
|
||||
private readonly ILogger<SystemInfoService> _logger;
|
||||
private readonly IHubContext<MareHub> _hubContext;
|
||||
private Timer _timer;
|
||||
public SystemInfoDto SystemInfoDto { get; private set; } = new();
|
||||
|
||||
public SystemInfoService(IServiceProvider services, ILogger<SystemInfoService> logger, IHubContext<MareHub> hubContext)
|
||||
public SystemInfoService(MetricsService.MetricsServiceClient metricsClient, IServiceProvider services, ILogger<SystemInfoService> logger, IHubContext<MareHub> hubContext)
|
||||
{
|
||||
this.metricsClient = metricsClient;
|
||||
_services = services;
|
||||
_logger = logger;
|
||||
_hubContext = hubContext;
|
||||
|
|
@ -46,10 +48,9 @@ public class SystemInfoService : IHostedService, IDisposable
|
|||
using var scope = _services.CreateScope();
|
||||
using var db = scope.ServiceProvider.GetService<MareDbContext>()!;
|
||||
|
||||
var metricsServiceClient = scope.ServiceProvider.GetService<MetricsService.MetricsServiceClient>()!;
|
||||
_ = metricsServiceClient.SetGauge(new SetGaugeRequest()
|
||||
metricsClient.SetGauge(new SetGaugeRequest()
|
||||
{ GaugeName = MetricsAPI.GaugeAvailableWorkerThreads, Value = workerThreads });
|
||||
_ = metricsServiceClient.SetGauge(new SetGaugeRequest()
|
||||
metricsClient.SetGauge(new SetGaugeRequest()
|
||||
{ GaugeName = MetricsAPI.GaugeAvailableIOWorkerThreads, Value = ioThreads });
|
||||
|
||||
var users = db.Users.Count(c => c.CharacterIdentification != null);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue