⚡ Adjustable delay ms
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
namespace DysonNetwork.Drive.Storage;
|
namespace DysonNetwork.Drive.Storage;
|
||||||
|
|
||||||
public class FileReanalysisBackgroundService(FileReanalysisService reanalysisService, ILogger<FileReanalysisBackgroundService> logger) : BackgroundService
|
public class FileReanalysisBackgroundService(FileReanalysisService reanalysisService, ILogger<FileReanalysisBackgroundService> logger, IConfiguration config) : BackgroundService
|
||||||
{
|
{
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
@@ -17,8 +17,9 @@ public class FileReanalysisBackgroundService(FileReanalysisService reanalysisSer
|
|||||||
logger.LogError(ex, "Error during file reanalysis");
|
logger.LogError(ex, "Error during file reanalysis");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait 10 seconds before processing next file
|
// Wait configured milliseconds before processing next file
|
||||||
await Task.Delay(TimeSpan.FromSeconds(10), stoppingToken);
|
var delayMs = config.GetValue("FileReanalysis:DelayMs", 10000);
|
||||||
|
await Task.Delay(TimeSpan.FromMilliseconds(delayMs), stoppingToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.LogInformation("File reanalysis background service stopped");
|
logger.LogInformation("File reanalysis background service stopped");
|
||||||
|
|||||||
@@ -119,6 +119,7 @@
|
|||||||
"FileReanalysis": {
|
"FileReanalysis": {
|
||||||
"Enabled": true,
|
"Enabled": true,
|
||||||
"ValidateCompression": true,
|
"ValidateCompression": true,
|
||||||
"ValidateThumbnails": true
|
"ValidateThumbnails": true,
|
||||||
|
"DelayMs": 10000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user