refactor: Remove redundant config validation

Validation already happens in ConfigParser, then SyncProcessor does not
need to do it as well.
pull/201/head
Robert Dailey 2 years ago
parent 8e22a5d561
commit c05d73a84b

@ -1,6 +1,5 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Flurl.Http; using Flurl.Http;
using JetBrains.Annotations;
using Recyclarr.Common.Extensions; using Recyclarr.Common.Extensions;
using Recyclarr.TrashLib.Config; using Recyclarr.TrashLib.Config;
using Recyclarr.TrashLib.Config.Parsing; using Recyclarr.TrashLib.Config.Parsing;
@ -14,13 +13,11 @@ using Spectre.Console;
namespace Recyclarr.TrashLib.Services.Processors; namespace Recyclarr.TrashLib.Services.Processors;
[UsedImplicitly]
[SuppressMessage("Design", "CA1031:Do not catch general exception types")] [SuppressMessage("Design", "CA1031:Do not catch general exception types")]
public class SyncProcessor : ISyncProcessor public class SyncProcessor : ISyncProcessor
{ {
private readonly IAnsiConsole _console; private readonly IAnsiConsole _console;
private readonly ILogger _log; private readonly ILogger _log;
private readonly ConfigValidationExecutor _validator;
private readonly IConfigurationFinder _configFinder; private readonly IConfigurationFinder _configFinder;
private readonly IConfigurationLoader _configLoader; private readonly IConfigurationLoader _configLoader;
private readonly ServiceProcessorFactory _factory; private readonly ServiceProcessorFactory _factory;
@ -28,14 +25,12 @@ public class SyncProcessor : ISyncProcessor
public SyncProcessor( public SyncProcessor(
IAnsiConsole console, IAnsiConsole console,
ILogger log, ILogger log,
ConfigValidationExecutor validator,
IConfigurationFinder configFinder, IConfigurationFinder configFinder,
IConfigurationLoader configLoader, IConfigurationLoader configLoader,
ServiceProcessorFactory factory) ServiceProcessorFactory factory)
{ {
_console = console; _console = console;
_log = log; _log = log;
_validator = validator;
_configFinder = configFinder; _configFinder = configFinder;
_configLoader = configLoader; _configLoader = configLoader;
_factory = factory; _factory = factory;
@ -105,13 +100,6 @@ public class SyncProcessor : ISyncProcessor
} }
PrintProcessingHeader(service.ToString(), config); PrintProcessingHeader(service.ToString(), config);
if (!_validator.Validate(config))
{
// Useful logs are printed in the Validate method
continue;
}
using var processor = _factory.CreateProcessor<TConfig>(config); using var processor = _factory.CreateProcessor<TConfig>(config);
await processor.Value.Process(config, settings); await processor.Value.Process(config, settings);
} }

Loading…
Cancel
Save