mirror of
https://git.v0l.io/Kieran/void.cat.git
synced 2025-11-15 14:07:19 +01:00
Catch exceptions in expired deletion service
This commit is contained in:
@@ -21,6 +21,8 @@ public sealed class DeleteExpiredFiles : BackgroundService
|
|||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
while (!stoppingToken.IsCancellationRequested)
|
while (!stoppingToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
using var scope = _scopeFactory.CreateScope();
|
using var scope = _scopeFactory.CreateScope();
|
||||||
var metadata = scope.ServiceProvider.GetRequiredService<IFileMetadataStore>();
|
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);
|
await Task.Delay(TimeSpan.FromMinutes(5), stoppingToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user