forked from Kieran/void.cat
Catch exceptions in expired deletion service
This commit is contained in:
parent
de975be92f
commit
1c370dfd24
@ -21,6 +21,8 @@ public sealed class DeleteExpiredFiles : BackgroundService
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
while (!stoppingToken.IsCancellationRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
var metadata = scope.ServiceProvider.GetRequiredService<IFileMetadataStore>();
|
||||
@ -46,6 +48,12 @@ public sealed class DeleteExpiredFiles : BackgroundService
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to run delete expired file services");
|
||||
}
|
||||
|
||||
await Task.Delay(TimeSpan.FromMinutes(5), stoppingToken);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user