mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-01-01 02:18:36 -05:00
* fixed unwanted deletion of torrents in downloading metadata state * refactored jobs code * updated arr test data * updated gitignore * updated test configuration and removed dispensable files
31 lines
672 B
C#
31 lines
672 B
C#
using Infrastructure.Verticals.Jobs;
|
|
using Quartz;
|
|
|
|
namespace Executable.Jobs;
|
|
|
|
[DisallowConcurrentExecution]
|
|
public sealed class GenericJob<T> : IJob
|
|
where T : GenericHandler
|
|
{
|
|
private readonly ILogger<GenericJob<T>> _logger;
|
|
private readonly T _handler;
|
|
|
|
|
|
public GenericJob(ILogger<GenericJob<T>> logger, T handler)
|
|
{
|
|
_logger = logger;
|
|
_handler = handler;
|
|
}
|
|
|
|
public async Task Execute(IJobExecutionContext context)
|
|
{
|
|
try
|
|
{
|
|
await _handler.ExecuteAsync();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_logger.LogError(ex, "{name} failed", typeof(T).Name);
|
|
}
|
|
}
|
|
} |