Removed the potential locking

pull/1882/head
tidusjar 7 years ago
parent 6e79574aba
commit 96697000b1

@ -42,6 +42,7 @@ namespace Ombi.Notifications.Interfaces
public async Task NotifyAsync(NotificationOptions model) public async Task NotifyAsync(NotificationOptions model)
{ {
Settings.ClearCache();
var configuration = await GetConfiguration(); var configuration = await GetConfiguration();
await NotifyAsync(model, configuration); await NotifyAsync(model, configuration);
} }

@ -30,11 +30,9 @@ namespace Ombi.Schedule.Jobs.SickRage
private readonly ISickRageApi _api; private readonly ISickRageApi _api;
private readonly ILogger<SickRageSync> _log; private readonly ILogger<SickRageSync> _log;
private readonly IOmbiContext _ctx; private readonly IOmbiContext _ctx;
private static readonly SemaphoreSlim SemaphoreSlim = new SemaphoreSlim(1, 1);
public async Task Start() public async Task Start()
{ {
await SemaphoreSlim.WaitAsync();
try try
{ {
var settings = await _settings.GetSettingsAsync(); var settings = await _settings.GetSettingsAsync();
@ -42,6 +40,7 @@ namespace Ombi.Schedule.Jobs.SickRage
{ {
return; return;
} }
var shows = await _api.GetShows(settings.ApiKey, settings.FullUri); var shows = await _api.GetShows(settings.ApiKey, settings.FullUri);
if (shows != null) if (shows != null)
{ {
@ -83,10 +82,6 @@ namespace Ombi.Schedule.Jobs.SickRage
{ {
_log.LogError(LoggingEvents.SickRageCacher, e, "Exception when trying to cache SickRage"); _log.LogError(LoggingEvents.SickRageCacher, e, "Exception when trying to cache SickRage");
} }
finally
{
SemaphoreSlim.Release();
}
} }
private bool _disposed; private bool _disposed;

@ -30,11 +30,9 @@ namespace Ombi.Schedule.Jobs.Sonarr
private readonly ISonarrApi _api; private readonly ISonarrApi _api;
private readonly ILogger<SonarrSync> _log; private readonly ILogger<SonarrSync> _log;
private readonly IOmbiContext _ctx; private readonly IOmbiContext _ctx;
private static readonly SemaphoreSlim SemaphoreSlim = new SemaphoreSlim(1, 1);
public async Task Start() public async Task Start()
{ {
await SemaphoreSlim.WaitAsync();
try try
{ {
var settings = await _settings.GetSettingsAsync(); var settings = await _settings.GetSettingsAsync();
@ -79,10 +77,6 @@ namespace Ombi.Schedule.Jobs.Sonarr
{ {
_log.LogError(LoggingEvents.SonarrCacher, e, "Exception when trying to cache Sonarr"); _log.LogError(LoggingEvents.SonarrCacher, e, "Exception when trying to cache Sonarr");
} }
finally
{
SemaphoreSlim.Release();
}
} }
private bool _disposed; private bool _disposed;

Loading…
Cancel
Save