fix: Fix incorrect version enforcement for Sonarr

When using multiple instances of Sonarr at v4 and v3, it was possible to
get a VersionException due to stale information carrying over between
processing instances.
pull/138/head
Robert Dailey 2 years ago
parent 361078ef86
commit 3a21465ff1

@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- Sonarr: Incorrect VersionException occurred when using mixed versions of Sonarr (v4 & v3)
## [2.6.0] - 2022-10-14
### Added

@ -1,3 +1,4 @@
using Autofac;
using CliFx.Attributes;
using CliFx.Exceptions;
using JetBrains.Annotations;
@ -49,7 +50,6 @@ public class SonarrCommand : ServiceCommand
var log = container.Resolve<ILogger>();
var customFormatUpdaterFactory = container.Resolve<Func<ICustomFormatUpdater>>();
var guideService = container.Resolve<ISonarrGuideService>();
var versionEnforcement = container.Resolve<ISonarrVersionEnforcement>();
if (ListReleaseProfiles)
{
@ -88,6 +88,9 @@ public class SonarrCommand : ServiceCommand
{
log.Information("Processing server {Url}", FlurlLogging.SanitizeUrl(config.BaseUrl));
var scope = container.Container.BeginLifetimeScope();
var versionEnforcement = scope.Resolve<ISonarrVersionEnforcement>();
await versionEnforcement.DoVersionEnforcement(config);
if (config.ReleaseProfiles.Count > 0)

@ -15,8 +15,8 @@ public class ConfigAutofacModule : Module
.AsClosedTypesOf(typeof(IValidator<>))
.AsImplementedInterfaces();
builder.RegisterType<ConfigurationProvider>().As<IConfigurationProvider>().InstancePerLifetimeScope();
builder.RegisterType<SettingsProvider>().As<ISettingsProvider>().InstancePerLifetimeScope();
builder.RegisterType<ConfigurationProvider>().As<IConfigurationProvider>().SingleInstance();
builder.RegisterType<SettingsProvider>().As<ISettingsProvider>().SingleInstance();
builder.RegisterType<YamlSerializerFactory>().As<IYamlSerializerFactory>();
}
}

Loading…
Cancel
Save