mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-03-06 07:16:10 -05:00
changed failed import naming
This commit is contained in:
@@ -6,8 +6,7 @@ public abstract class ArrConfig : IConfig
|
||||
{
|
||||
public bool Enabled { get; init; }
|
||||
|
||||
[ConfigurationKeyName("IMPORT_FAILED_MAX_STRIKES")]
|
||||
public short ImportFailedMaxStrikes { get; init; } = -1;
|
||||
public short FailedImportMaxStrikes { get; init; } = -1;
|
||||
|
||||
public List<ArrInstance> Instances { get; init; } = [];
|
||||
|
||||
|
||||
@@ -16,13 +16,13 @@ public sealed record QueueCleanerConfig : IJobConfig
|
||||
|
||||
public string IgnoredDownloadsPath { get; init; } = string.Empty;
|
||||
|
||||
public ushort ImportFailedMaxStrikes { get; init; }
|
||||
public ushort FailedImportMaxStrikes { get; init; }
|
||||
|
||||
public bool ImportFailedIgnorePrivate { get; init; }
|
||||
public bool FailedImportIgnorePrivate { get; init; }
|
||||
|
||||
public bool ImportFailedDeletePrivate { get; init; }
|
||||
public bool FailedImportDeletePrivate { get; init; }
|
||||
|
||||
public IReadOnlyList<string> ImportFailedIgnorePatterns { get; init; } = [];
|
||||
public IReadOnlyList<string> FailedImportIgnorePatterns { get; init; } = [];
|
||||
|
||||
public ushort StalledMaxStrikes { get; init; }
|
||||
|
||||
@@ -56,7 +56,7 @@ public sealed record QueueCleanerConfig : IJobConfig
|
||||
|
||||
public void Validate()
|
||||
{
|
||||
if (ImportFailedMaxStrikes is > 0 and < 3)
|
||||
if (FailedImportMaxStrikes is > 0 and < 3)
|
||||
{
|
||||
throw new ValidationException($"the minimum value for {SectionName.ToUpperInvariant()}__IMPORT_FAILED_MAX_STRIKES must be 3");
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ public enum DeleteReason
|
||||
{
|
||||
None,
|
||||
Stalled,
|
||||
ImportFailed,
|
||||
FailedImport,
|
||||
DownloadingMetadata,
|
||||
SlowSpeed,
|
||||
SlowTime,
|
||||
|
||||
@@ -74,7 +74,7 @@ public abstract class ArrClient : IArrClient
|
||||
|
||||
public virtual async Task<bool> ShouldRemoveFromQueue(InstanceType instanceType, QueueRecord record, bool isPrivateDownload, short arrMaxStrikes)
|
||||
{
|
||||
if (_queueCleanerConfig.ImportFailedIgnorePrivate && isPrivateDownload)
|
||||
if (_queueCleanerConfig.FailedImportIgnorePrivate && isPrivateDownload)
|
||||
{
|
||||
// ignore private trackers
|
||||
_logger.LogDebug("skip failed import check | download is private | {name}", record.Title);
|
||||
@@ -108,7 +108,7 @@ public abstract class ArrClient : IArrClient
|
||||
return false;
|
||||
}
|
||||
|
||||
ushort maxStrikes = arrMaxStrikes > 0 ? (ushort)arrMaxStrikes : _queueCleanerConfig.ImportFailedMaxStrikes;
|
||||
ushort maxStrikes = arrMaxStrikes > 0 ? (ushort)arrMaxStrikes : _queueCleanerConfig.FailedImportMaxStrikes;
|
||||
|
||||
return await _striker.StrikeAndCheckLimit(
|
||||
record.DownloadId,
|
||||
@@ -214,7 +214,7 @@ public abstract class ArrClient : IArrClient
|
||||
|
||||
private bool HasIgnoredPatterns(QueueRecord record)
|
||||
{
|
||||
if (_queueCleanerConfig.ImportFailedIgnorePatterns.Count is 0)
|
||||
if (_queueCleanerConfig.FailedImportIgnorePatterns.Count is 0)
|
||||
{
|
||||
// no patterns are configured
|
||||
return false;
|
||||
@@ -234,7 +234,7 @@ public abstract class ArrClient : IArrClient
|
||||
.ForEach(x => messages.Add(x));
|
||||
|
||||
return messages.Any(
|
||||
m => _queueCleanerConfig.ImportFailedIgnorePatterns.Any(
|
||||
m => _queueCleanerConfig.FailedImportIgnorePatterns.Any(
|
||||
p => !string.IsNullOrWhiteSpace(p.Trim()) && m.Contains(p, StringComparison.InvariantCultureIgnoreCase)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -148,8 +148,8 @@ public sealed class QueueCleaner : GenericHandler
|
||||
}
|
||||
|
||||
// failed import check
|
||||
bool shouldRemoveFromArr = await arrClient.ShouldRemoveFromQueue(instanceType, record, downloadCheckResult.IsPrivate, config.ImportFailedMaxStrikes);
|
||||
DeleteReason deleteReason = downloadCheckResult.ShouldRemove ? downloadCheckResult.DeleteReason : DeleteReason.ImportFailed;
|
||||
bool shouldRemoveFromArr = await arrClient.ShouldRemoveFromQueue(instanceType, record, downloadCheckResult.IsPrivate, config.FailedImportMaxStrikes);
|
||||
DeleteReason deleteReason = downloadCheckResult.ShouldRemove ? downloadCheckResult.DeleteReason : DeleteReason.FailedImport;
|
||||
|
||||
if (!shouldRemoveFromArr && !downloadCheckResult.ShouldRemove)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ public sealed class QueueCleaner : GenericHandler
|
||||
!_config.SlowDeletePrivate;
|
||||
|
||||
bool shouldKeepDueToDeleteRules = downloadCheckResult.ShouldRemove && (isStalledWithoutPruneFlag || isSlowWithoutPruneFlag);
|
||||
bool shouldKeepDueToImportRules = shouldRemoveFromArr && !_config.ImportFailedDeletePrivate;
|
||||
bool shouldKeepDueToImportRules = shouldRemoveFromArr && !_config.FailedImportDeletePrivate;
|
||||
|
||||
if (shouldKeepDueToDeleteRules || shouldKeepDueToImportRules)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user