Drive reanalysis service

This commit is contained in:
2026-01-13 01:06:47 +08:00
parent 0f74ed61fd
commit 4b7740e606
4 changed files with 296 additions and 5 deletions

View File

@@ -0,0 +1,26 @@
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");
}
}