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;
|
namespace Common.Configuration.QueueCleaner;
|
||||||
|
|
||||||
@@ -39,5 +40,14 @@ public sealed record QueueCleanerConfig : IJobConfig, IIgnoredDownloadsConfig
|
|||||||
|
|
||||||
public void Validate()
|
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 = config.Value;
|
||||||
|
_config.Validate();
|
||||||
_ignoredDownloadsProvider = ignoredDownloadsProvider;
|
_ignoredDownloadsProvider = ignoredDownloadsProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -114,7 +114,7 @@
|
|||||||
- Set to `0` to never remove failed imports.
|
- 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.
|
- A strike is given when an item is stalled, stuck in metadata downloading, or failed to be imported.
|
||||||
- Type: Integer
|
- Type: Integer
|
||||||
- Possible values: `0` or greater
|
- Possible values: `0` or a number greater than `2`.
|
||||||
- Default: `0`
|
- Default: `0`
|
||||||
- Required: No.
|
- Required: No.
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ QUEUECLEANER__IMPORT_FAILED_IGNORE_PATTERNS__1: "manual import required"
|
|||||||
- Set to `0` to never remove stalled downloads.
|
- Set to `0` to never remove stalled downloads.
|
||||||
- A strike is given when download speed is 0.
|
- A strike is given when download speed is 0.
|
||||||
- Type: Integer
|
- Type: Integer
|
||||||
- Possible values: `0` or greater
|
- Possible values: `0` or a number greater than `2`.
|
||||||
- Default: `0`
|
- Default: `0`
|
||||||
- Required: No.
|
- Required: No.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user