Fixed SeedConfigProvider cache refresh after indexer settings change

This commit is contained in:
Taloth Saldono 2021-04-23 19:18:09 +02:00
parent 4e77a9df10
commit 1400b96816
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.Datastore;
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 @@ namespace NzbDrone.Core.Indexers
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 @@ namespace NzbDrone.Core.Indexers
}
}
public void Handle(IndexerSettingUpdatedEvent message)
public void Handle(ProviderUpdatedEvent<IIndexer> message)
{
_cache.Clear();
}

View File

@ -103,7 +103,10 @@ namespace NzbDrone.Core.ThingiProvider
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)