mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-12 17:57:21 +01:00
adjust shard cleanup service too
This commit is contained in:
parent
b4830e9f8a
commit
79b6dcf646
1 changed files with 4 additions and 2 deletions
|
|
@ -43,10 +43,12 @@ public class ShardFileCleanupService : IHostedService
|
||||||
_logger.LogError(e, "Error during cleanup task");
|
_logger.LogError(e, "Error during cleanup task");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var cleanupCheckMinutes = _configuration.GetValueOrDefault(nameof(StaticFilesServerConfiguration.CleanupCheckInMinutes), 15);
|
||||||
|
|
||||||
var now = DateTime.Now;
|
var now = DateTime.Now;
|
||||||
TimeOnly currentTime = new(now.Hour, now.Minute, now.Second);
|
TimeOnly currentTime = new(now.Hour, now.Minute, now.Second);
|
||||||
TimeOnly futureTime = new(now.Hour, now.Minute - now.Minute % 15, 0);
|
TimeOnly futureTime = new(now.Hour, now.Minute - now.Minute % cleanupCheckMinutes, 0);
|
||||||
var span = futureTime.AddMinutes(15) - currentTime;
|
var span = futureTime.AddMinutes(cleanupCheckMinutes) - currentTime;
|
||||||
|
|
||||||
_logger.LogInformation("File Cleanup Complete, next run at {date}", now.Add(span));
|
_logger.LogInformation("File Cleanup Complete, next run at {date}", now.Add(span));
|
||||||
await Task.Delay(span, ct).ConfigureAwait(false);
|
await Task.Delay(span, ct).ConfigureAwait(false);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue