mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-20 01:42:35 +01:00
Fixed: Removing invalid statuses on provider deletion
This commit is contained in:
parent
e8bb3df68e
commit
0ad4d7ea9a
@ -8,6 +8,7 @@ public interface IProviderStatusRepository<TModel> : IBasicRepository<TModel>
|
||||
where TModel : ProviderStatusBase, new()
|
||||
{
|
||||
TModel FindByProviderId(int providerId);
|
||||
void DeleteByProviderId(int providerId);
|
||||
}
|
||||
|
||||
public class ProviderStatusRepository<TModel> : BasicRepository<TModel>, IProviderStatusRepository<TModel>
|
||||
@ -22,5 +23,10 @@ public TModel FindByProviderId(int providerId)
|
||||
{
|
||||
return Query(x => x.ProviderId == providerId).SingleOrDefault();
|
||||
}
|
||||
|
||||
public void DeleteByProviderId(int providerId)
|
||||
{
|
||||
Delete(c => c.ProviderId == providerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,12 +151,7 @@ public virtual void RecordConnectionFailure(int providerId)
|
||||
|
||||
public virtual void HandleAsync(ProviderDeletedEvent<TProvider> message)
|
||||
{
|
||||
var providerStatus = _providerStatusRepository.FindByProviderId(message.ProviderId);
|
||||
|
||||
if (providerStatus != null)
|
||||
{
|
||||
_providerStatusRepository.Delete(providerStatus);
|
||||
}
|
||||
_providerStatusRepository.DeleteByProviderId(message.ProviderId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user