Cleaned up some warnings and implemented re-occuring scan libraries task. Customization of task schedules is in v0.2.

This commit is contained in:
Joseph Milazzo 2021-01-19 14:41:50 -06:00
parent e180032a8e
commit 3c8e4b2240
13 changed files with 20 additions and 58 deletions

View file

@ -8,21 +8,19 @@ namespace API.Services
{
private readonly ICacheService _cacheService;
private readonly ILogger<TaskScheduler> _logger;
private readonly IUnitOfWork _unitOfWork;
private readonly IDirectoryService _directoryService;
public BackgroundJobServer Client => new BackgroundJobServer();
public TaskScheduler(ICacheService cacheService, ILogger<TaskScheduler> logger,
IUnitOfWork unitOfWork, IDirectoryService directoryService)
IDirectoryService directoryService)
{
_cacheService = cacheService;
_logger = logger;
_unitOfWork = unitOfWork;
_directoryService = directoryService;
_logger.LogInformation("Scheduling/Updating cache cleanup on a daily basis.");
RecurringJob.AddOrUpdate(() => _cacheService.Cleanup(), Cron.Daily);
//RecurringJob.AddOrUpdate(() => scanService.ScanLibraries(), Cron.Daily);
RecurringJob.AddOrUpdate(() => directoryService.ScanLibraries(), Cron.Daily);
}
public void ScanLibrary(int libraryId, bool forceUpdate = false)