feat: add clean job
This commit is contained in:
parent
3ed521350e
commit
5133e80273
44
src/CasaBot/AutoScan/Jobs/CleanJob.cs
Normal file
44
src/CasaBot/AutoScan/Jobs/CleanJob.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using AutoScan.Options;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Quartz;
|
||||
|
||||
namespace AutoScan.Jobs;
|
||||
|
||||
public class CleanJob : IJob
|
||||
{
|
||||
private readonly ILogger<CleanJob> _logger;
|
||||
private readonly AutoScanOptions _options;
|
||||
|
||||
public CleanJob(IOptions<AutoScanOptions> options, ILogger<CleanJob> logger)
|
||||
{
|
||||
_options = options.Value;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
_logger.LogInformation("Cleaning up files...");
|
||||
if (_options.RemoveOriginalFiles)
|
||||
{
|
||||
CleanOriginalFiles();
|
||||
}
|
||||
|
||||
if (_options.RemoveDetectionFiles)
|
||||
{
|
||||
CleanDetectionFiles();
|
||||
}
|
||||
|
||||
await Task.Delay(200);
|
||||
}
|
||||
|
||||
private void CleanOriginalFiles()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void CleanDetectionFiles()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user