Files
Swarm/DysonNetwork.Drive/Storage/FileReanalysisBackgroundService.cs
2026-01-13 01:06:47 +08:00

27 lines
890 B
C#

namespace DysonNetwork.Drive.Storage;
public class FileReanalysisBackgroundService(FileReanalysisService reanalysisService, ILogger<FileReanalysisBackgroundService> logger) : BackgroundService
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
logger.LogInformation("File reanalysis background service started");
while (!stoppingToken.IsCancellationRequested)
{
try
{
await reanalysisService.ProcessNextFileAsync();
}
catch (Exception ex)
{
logger.LogError(ex, "Error during file reanalysis");
}
// Wait 10 seconds before processing next file
await Task.Delay(TimeSpan.FromSeconds(10), stoppingToken);
}
logger.LogInformation("File reanalysis background service stopped");
}
}