mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-01-17 10:45:49 +02:00
Fixed: Perform health check after download clients or indexers are removed
Closes #1304
This commit is contained in:
parent
aec3ed16d0
commit
4f5d79b189
@ -23,7 +23,9 @@ public class HealthCheckService : IHealthCheckService,
|
||||
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 @@ private void PerformHealthCheck(Func<IProvideHealthCheck, bool> predicate)
|
||||
_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 @@ public void HandleAsync(ProviderUpdatedEvent<IIndexer> message)
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user