From 355d34c730712a69ee8a5d789f708e00d306db18 Mon Sep 17 00:00:00 2001 From: Stanley Dimant Date: Tue, 14 Jan 2025 10:17:00 +0100 Subject: [PATCH] move gauge init into cleanup task --- .../Services/MainFileCleanupService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MareSynchronosServer/MareSynchronosStaticFilesServer/Services/MainFileCleanupService.cs b/MareSynchronosServer/MareSynchronosStaticFilesServer/Services/MainFileCleanupService.cs index bfc1968..1ec73d3 100644 --- a/MareSynchronosServer/MareSynchronosStaticFilesServer/Services/MainFileCleanupService.cs +++ b/MareSynchronosServer/MareSynchronosStaticFilesServer/Services/MainFileCleanupService.cs @@ -32,8 +32,6 @@ public class MainFileCleanupService : IHostedService { _logger.LogInformation("Cleanup Service started"); - InitializeGauges(); - _cleanupCts = new(); _ = Task.Run(() => CleanUpTask(_cleanupCts.Token)).ConfigureAwait(false); @@ -150,6 +148,8 @@ public class MainFileCleanupService : IHostedService private async Task CleanUpTask(CancellationToken ct) { + InitializeGauges(); + while (!ct.IsCancellationRequested) { var cleanupCheckMinutes = _configuration.GetValueOrDefault(nameof(StaticFilesServerConfiguration.CleanupCheckInMinutes), 15);