mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2025-12-23 22:18:39 -05:00
Restrict max strikes to a minimum value (#87)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Common.Exceptions;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Common.Configuration.QueueCleaner;
|
||||
|
||||
@@ -39,5 +40,14 @@ public sealed record QueueCleanerConfig : IJobConfig, IIgnoredDownloadsConfig
|
||||
|
||||
public void Validate()
|
||||
{
|
||||
if (ImportFailedMaxStrikes is > 0 and < 3)
|
||||
{
|
||||
throw new ValidationException("the minimum value for IMPORT_FAILED_MAX_STRIKES must be 3");
|
||||
}
|
||||
|
||||
if (StalledMaxStrikes is > 0 and < 3)
|
||||
{
|
||||
throw new ValidationException("the minimum value for STALLED_MAX_STRIKES must be 3");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ public sealed class QueueCleaner : GenericHandler
|
||||
)
|
||||
{
|
||||
_config = config.Value;
|
||||
_config.Validate();
|
||||
_ignoredDownloadsProvider = ignoredDownloadsProvider;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
- Set to `0` to never remove failed imports.
|
||||
- A strike is given when an item is stalled, stuck in metadata downloading, or failed to be imported.
|
||||
- Type: Integer
|
||||
- Possible values: `0` or greater
|
||||
- Possible values: `0` or a number greater than `2`.
|
||||
- Default: `0`
|
||||
- Required: No.
|
||||
|
||||
@@ -153,7 +153,7 @@ QUEUECLEANER__IMPORT_FAILED_IGNORE_PATTERNS__1: "manual import required"
|
||||
- Set to `0` to never remove stalled downloads.
|
||||
- A strike is given when download speed is 0.
|
||||
- Type: Integer
|
||||
- Possible values: `0` or greater
|
||||
- Possible values: `0` or a number greater than `2`.
|
||||
- Default: `0`
|
||||
- Required: No.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user