mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-05-24 22:44:39 -04:00
Fix empty torrents (#11)
* 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
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
using Infrastructure.Verticals.ContentBlocker;
|
||||
using Quartz;
|
||||
|
||||
namespace Executable.Jobs;
|
||||
|
||||
[DisallowConcurrentExecution]
|
||||
public sealed class ContentBlockerJob : IJob
|
||||
{
|
||||
private readonly ILogger<QueueCleanerJob> _logger;
|
||||
private readonly ContentBlocker _contentBlocker;
|
||||
|
||||
public ContentBlockerJob(
|
||||
ILogger<QueueCleanerJob> logger,
|
||||
ContentBlocker contentBlocker
|
||||
)
|
||||
{
|
||||
_logger = logger;
|
||||
_contentBlocker = contentBlocker;
|
||||
}
|
||||
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _contentBlocker.ExecuteAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, $"{nameof(ContentBlockerJob)} failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
31
code/Executable/Jobs/GenericJob.cs
Normal file
31
code/Executable/Jobs/GenericJob.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using Infrastructure.Verticals.QueueCleaner;
|
||||
using Quartz;
|
||||
|
||||
namespace Executable.Jobs;
|
||||
|
||||
[DisallowConcurrentExecution]
|
||||
public sealed class QueueCleanerJob : IJob
|
||||
{
|
||||
private readonly ILogger<QueueCleanerJob> _logger;
|
||||
private readonly QueueCleaner _queueCleaner;
|
||||
|
||||
public QueueCleanerJob(
|
||||
ILogger<QueueCleanerJob> logger,
|
||||
QueueCleaner queueCleaner
|
||||
)
|
||||
{
|
||||
_logger = logger;
|
||||
_queueCleaner = queueCleaner;
|
||||
}
|
||||
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _queueCleaner.ExecuteAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, $"{nameof(QueueCleanerJob)} failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user