Fixed SeedConfigProvider cache refresh after indexer settings change
This commit is contained in:
parent
411be4d011
commit
8e46362ff9
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,6 +6,7 @@ using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Download.Clients;
|
using NzbDrone.Core.Download.Clients;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
using NzbDrone.Core.ThingiProvider.Events;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers
|
namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
|
@ -15,7 +16,7 @@ namespace NzbDrone.Core.Indexers
|
||||||
TorrentSeedConfiguration GetSeedConfiguration(int indexerId, bool fullSeason);
|
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 IIndexerFactory _indexerFactory;
|
||||||
private readonly ICached<SeedCriteriaSettings> _cache;
|
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();
|
_cache.Clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,10 @@ namespace NzbDrone.Core.ThingiProvider
|
||||||
|
|
||||||
public virtual TProviderDefinition Create(TProviderDefinition definition)
|
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)
|
public virtual void Update(TProviderDefinition definition)
|
||||||
|
|
Loading…
Reference in New Issue