From 79b6dcf6468b35e0fae4bdf5c6109bdf41719d08 Mon Sep 17 00:00:00 2001 From: rootdarkarchon Date: Wed, 17 Jan 2024 01:40:25 +0100 Subject: [PATCH] adjust shard cleanup service too --- .../Services/ShardFileCleanupService.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MareSynchronosServer/MareSynchronosStaticFilesServer/Services/ShardFileCleanupService.cs b/MareSynchronosServer/MareSynchronosStaticFilesServer/Services/ShardFileCleanupService.cs index cb26ddb..4f4401a 100644 --- a/MareSynchronosServer/MareSynchronosStaticFilesServer/Services/ShardFileCleanupService.cs +++ b/MareSynchronosServer/MareSynchronosStaticFilesServer/Services/ShardFileCleanupService.cs @@ -43,10 +43,12 @@ public class ShardFileCleanupService : IHostedService _logger.LogError(e, "Error during cleanup task"); } + var cleanupCheckMinutes = _configuration.GetValueOrDefault(nameof(StaticFilesServerConfiguration.CleanupCheckInMinutes), 15); + var now = DateTime.Now; TimeOnly currentTime = new(now.Hour, now.Minute, now.Second); - TimeOnly futureTime = new(now.Hour, now.Minute - now.Minute % 15, 0); - var span = futureTime.AddMinutes(15) - currentTime; + TimeOnly futureTime = new(now.Hour, now.Minute - now.Minute % cleanupCheckMinutes, 0); + var span = futureTime.AddMinutes(cleanupCheckMinutes) - currentTime; _logger.LogInformation("File Cleanup Complete, next run at {date}", now.Add(span)); await Task.Delay(span, ct).ConfigureAwait(false);