Fixed: Perform health check after download clients or indexers are removed

Closes #1304
This commit is contained in:
Mark McDowall 2016-05-20 23:29:29 -07:00
parent aec3ed16d0
commit 4f5d79b189
1 changed files with 20 additions and 8 deletions

View File

@ -23,7 +23,9 @@ namespace NzbDrone.Core.HealthCheck
IHandleAsync<ApplicationStartedEvent>,
IHandleAsync<ConfigSavedEvent>,
IHandleAsync<ProviderUpdatedEvent<IIndexer>>,
IHandleAsync<ProviderUpdatedEvent<IDownloadClient>>
IHandleAsync<ProviderDeletedEvent<IIndexer>>,
IHandleAsync<ProviderUpdatedEvent<IDownloadClient>>,
IHandleAsync<ProviderDeletedEvent<IDownloadClient>>
{
private readonly IEnumerable<IProvideHealthCheck> _healthChecks;
private readonly IEventAggregator _eventAggregator;
@ -72,6 +74,16 @@ namespace NzbDrone.Core.HealthCheck
_eventAggregator.PublishEvent(new HealthCheckCompleteEvent());
}
public void Execute(CheckHealthCommand message)
{
PerformHealthCheck(c => message.Trigger == CommandTrigger.Manual || c.CheckOnSchedule);
}
public void HandleAsync(ApplicationStartedEvent message)
{
PerformHealthCheck(c => c.CheckOnStartup);
}
public void HandleAsync(ConfigSavedEvent message)
{
PerformHealthCheck(c => c.CheckOnConfigChange);
@ -82,19 +94,19 @@ namespace NzbDrone.Core.HealthCheck
PerformHealthCheck(c => c.CheckOnConfigChange);
}
public void HandleAsync(ProviderDeletedEvent<IIndexer> message)
{
PerformHealthCheck(c => c.CheckOnConfigChange);
}
public void HandleAsync(ProviderUpdatedEvent<IDownloadClient> message)
{
PerformHealthCheck(c => c.CheckOnConfigChange);
}
public void HandleAsync(ApplicationStartedEvent message)
public void HandleAsync(ProviderDeletedEvent<IDownloadClient> message)
{
PerformHealthCheck(c => c.CheckOnStartup);
}
public void Execute(CheckHealthCommand message)
{
PerformHealthCheck(c => message.Trigger == CommandTrigger.Manual || c.CheckOnSchedule);
PerformHealthCheck(c => c.CheckOnConfigChange);
}
}
}