1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Fixed SeedConfigProvider cache refresh after indexer settings change

This commit is contained in:
Taloth Saldono 2021-04-23 19:18:09 +02:00 committed by Taloth
parent 411be4d011
commit 8e46362ff9
3 changed files with 7 additions and 20 deletions

View File

@ -1,17 +0,0 @@
using NzbDrone.Common.Messaging;
using NzbDrone.Core.ThingiProvider;
namespace NzbDrone.Core.Indexers
{
public class IndexerSettingUpdatedEvent : IEvent
{
public string IndexerName { get; private set; }
public IProviderConfig IndexerSetting { get; private set; }
public IndexerSettingUpdatedEvent(string indexerName, IProviderConfig indexerSetting)
{
IndexerName = indexerName;
IndexerSetting = indexerSetting;
}
}
}

View File

@ -6,6 +6,7 @@
using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider.Events;
namespace NzbDrone.Core.Indexers
{
@ -15,7 +16,7 @@ public interface ISeedConfigProvider
TorrentSeedConfiguration GetSeedConfiguration(int indexerId, bool fullSeason);
}
public class SeedConfigProvider : ISeedConfigProvider, IHandle<IndexerSettingUpdatedEvent>
public class SeedConfigProvider : ISeedConfigProvider, IHandle<ProviderUpdatedEvent<IIndexer>>
{
private readonly IIndexerFactory _indexerFactory;
private readonly ICached<SeedCriteriaSettings> _cache;
@ -71,7 +72,7 @@ private SeedCriteriaSettings FetchSeedCriteria(int indexerId)
}
}
public void Handle(IndexerSettingUpdatedEvent message)
public void Handle(ProviderUpdatedEvent<IIndexer> message)
{
_cache.Clear();
}

View File

@ -103,7 +103,10 @@ public TProviderDefinition Get(int id)
public virtual TProviderDefinition Create(TProviderDefinition definition)
{
return _providerRepository.Insert(definition);
var result = _providerRepository.Insert(definition);
_eventAggregator.PublishEvent(new ProviderUpdatedEvent<TProvider>(result));
return result;
}
public virtual void Update(TProviderDefinition definition)