diff --git a/MareSynchronosServer/MareSynchronosServer/Services/SystemInfoService.cs b/MareSynchronosServer/MareSynchronosServer/Services/SystemInfoService.cs index e4bdfb6..edeca4d 100644 --- a/MareSynchronosServer/MareSynchronosServer/Services/SystemInfoService.cs +++ b/MareSynchronosServer/MareSynchronosServer/Services/SystemInfoService.cs @@ -17,17 +17,15 @@ public class SystemInfoService : IHostedService, IDisposable { private readonly MareMetrics _mareMetrics; private readonly IClientIdentificationService clientIdentService; - private readonly IServiceProvider _services; private readonly ILogger _logger; private readonly IHubContext _hubContext; private Timer _timer; public SystemInfoDto SystemInfoDto { get; private set; } = new(); - public SystemInfoService(MareMetrics mareMetrics, IClientIdentificationService clientIdentService, IServiceProvider services, ILogger logger, IHubContext hubContext) + public SystemInfoService(MareMetrics mareMetrics, IClientIdentificationService clientIdentService, ILogger logger, IHubContext hubContext) { _mareMetrics = mareMetrics; this.clientIdentService = clientIdentService; - _services = services; _logger = logger; _hubContext = hubContext; } @@ -53,9 +51,6 @@ public class SystemInfoService : IHostedService, IDisposable var secondaryServer = Environment.GetEnvironmentVariable("SECONDARY_SERVER"); if (string.IsNullOrEmpty(secondaryServer) || secondaryServer == "0") { - using var scope = _services.CreateScope(); - using var db = scope.ServiceProvider.GetService()!; - SystemInfoDto = new SystemInfoDto() { CacheUsage = 0, diff --git a/MareSynchronosServer/MareSynchronosShared/Services/DistributedClientIdentificationService.cs b/MareSynchronosServer/MareSynchronosShared/Services/DistributedClientIdentificationService.cs index 89ff6a7..b7548fa 100644 --- a/MareSynchronosServer/MareSynchronosShared/Services/DistributedClientIdentificationService.cs +++ b/MareSynchronosServer/MareSynchronosShared/Services/DistributedClientIdentificationService.cs @@ -54,7 +54,12 @@ public class DistributedClientIdentificationService : BaseClientIdentificationSe public override void MarkUserOnline(string uid, string charaIdent) { base.MarkUserOnline(uid, charaIdent); - distributedCache.Set(RedisPrefix + uid, Encoding.UTF8.GetBytes(charaIdent)); + distributedCache.Set(RedisPrefix + uid, Encoding.UTF8.GetBytes(charaIdent), new DistributedCacheEntryOptions() + { + AbsoluteExpiration = DateTimeOffset.MaxValue, + AbsoluteExpirationRelativeToNow = TimeSpan.MaxValue, + SlidingExpiration = TimeSpan.MaxValue, + }); } public override Task StopAsync(CancellationToken cancellationToken)