Removed some areas where we clear out the cache. This should help with DB locking #2750

pull/2814/head
tidusjar 6 years ago
parent 215663df1f
commit da9c481bb4

@ -26,8 +26,6 @@ namespace Ombi.Notifications
MovieRepository = movie; MovieRepository = movie;
TvRepository = tv; TvRepository = tv;
CustomizationSettings = customization; CustomizationSettings = customization;
Settings.ClearCache();
CustomizationSettings.ClearCache();
RequestSubscription = sub; RequestSubscription = sub;
_log = log; _log = log;
AlbumRepository = album; AlbumRepository = album;
@ -55,14 +53,12 @@ namespace Ombi.Notifications
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);
} }
public async Task NotifyAsync(NotificationOptions model, Settings.Settings.Models.Settings settings) public async Task NotifyAsync(NotificationOptions model, Settings.Settings.Models.Settings settings)
{ {
Settings.ClearCache();
if (settings == null) await NotifyAsync(model); if (settings == null) await NotifyAsync(model);
var notificationSettings = (T)settings; var notificationSettings = (T)settings;

@ -28,7 +28,6 @@ namespace Ombi.Schedule.Jobs.Emby
_repo = repo; _repo = repo;
_episodeSync = epSync; _episodeSync = epSync;
_metadata = metadata; _metadata = metadata;
_settings.ClearCache();
} }
private readonly ILogger<EmbyContentSync> _logger; private readonly ILogger<EmbyContentSync> _logger;

@ -49,7 +49,6 @@ namespace Ombi.Schedule.Jobs.Emby
_settings = s; _settings = s;
_repo = repo; _repo = repo;
_avaliabilityChecker = checker; _avaliabilityChecker = checker;
_settings.ClearCache();
} }
private readonly ISettingsService<EmbySettings> _settings; private readonly ISettingsService<EmbySettings> _settings;

@ -50,8 +50,6 @@ namespace Ombi.Schedule.Jobs.Emby
_log = log; _log = log;
_embySettings = embySettings; _embySettings = embySettings;
_userManagementSettings = ums; _userManagementSettings = ums;
_userManagementSettings.ClearCache();
_embySettings.ClearCache();
} }
private readonly IEmbyApi _api; private readonly IEmbyApi _api;

@ -1,19 +1,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Hangfire; using Hangfire;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Ombi.Api.Lidarr; using Ombi.Api.Lidarr;
using Ombi.Api.Radarr;
using Ombi.Core.Settings; using Ombi.Core.Settings;
using Ombi.Helpers; using Ombi.Helpers;
using Ombi.Settings.Settings.Models.External; using Ombi.Settings.Settings.Models.External;
using Ombi.Store.Context; using Ombi.Store.Context;
using Ombi.Store.Entities; using Ombi.Store.Entities;
using Serilog;
using ILogger = Microsoft.Extensions.Logging.ILogger; using ILogger = Microsoft.Extensions.Logging.ILogger;
namespace Ombi.Schedule.Jobs.Lidarr namespace Ombi.Schedule.Jobs.Lidarr
@ -29,7 +26,6 @@ namespace Ombi.Schedule.Jobs.Lidarr
_ctx = ctx; _ctx = ctx;
_job = job; _job = job;
_availability = availability; _availability = availability;
_lidarrSettings.ClearCache();
} }
private readonly ISettingsService<LidarrSettings> _lidarrSettings; private readonly ISettingsService<LidarrSettings> _lidarrSettings;

@ -1,19 +1,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Hangfire; using Hangfire;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Ombi.Api.Lidarr; using Ombi.Api.Lidarr;
using Ombi.Api.Radarr;
using Ombi.Core.Settings; using Ombi.Core.Settings;
using Ombi.Helpers; using Ombi.Helpers;
using Ombi.Settings.Settings.Models.External; using Ombi.Settings.Settings.Models.External;
using Ombi.Store.Context; using Ombi.Store.Context;
using Ombi.Store.Entities; using Ombi.Store.Entities;
using Serilog;
using ILogger = Microsoft.Extensions.Logging.ILogger; using ILogger = Microsoft.Extensions.Logging.ILogger;
namespace Ombi.Schedule.Jobs.Lidarr namespace Ombi.Schedule.Jobs.Lidarr
@ -29,7 +26,6 @@ namespace Ombi.Schedule.Jobs.Lidarr
_ctx = ctx; _ctx = ctx;
_job = background; _job = background;
_albumSync = album; _albumSync = album;
_lidarrSettings.ClearCache();
} }
private readonly ISettingsService<LidarrSettings> _lidarrSettings; private readonly ISettingsService<LidarrSettings> _lidarrSettings;

@ -10,28 +10,23 @@ using Ombi.Schedule.Jobs.Emby;
using Ombi.Schedule.Jobs.Plex.Interfaces; using Ombi.Schedule.Jobs.Plex.Interfaces;
using Ombi.Store.Repository; using Ombi.Store.Repository;
namespace Ombi.Schedule.Jobs.Plex namespace Ombi.Schedule.Jobs.Ombi
{ {
public class MediaDatabaseRefresh : IMediaDatabaseRefresh public class MediaDatabaseRefresh : IMediaDatabaseRefresh
{ {
public MediaDatabaseRefresh(ISettingsService<PlexSettings> s, ILogger<MediaDatabaseRefresh> log, IPlexApi plexApi, public MediaDatabaseRefresh(ISettingsService<PlexSettings> s, ILogger<MediaDatabaseRefresh> log,
IPlexContentRepository plexRepo, IPlexContentSync c, IEmbyContentRepository embyRepo, IEmbyContentSync embySync) IPlexContentRepository plexRepo, IEmbyContentRepository embyRepo, IEmbyContentSync embySync)
{ {
_settings = s; _settings = s;
_log = log; _log = log;
_api = plexApi;
_plexRepo = plexRepo; _plexRepo = plexRepo;
_plexContentSync = c;
_embyRepo = embyRepo; _embyRepo = embyRepo;
_embyContentSync = embySync; _embyContentSync = embySync;
_settings.ClearCache();
} }
private readonly ISettingsService<PlexSettings> _settings; private readonly ISettingsService<PlexSettings> _settings;
private readonly ILogger _log; private readonly ILogger _log;
private readonly IPlexApi _api;
private readonly IPlexContentRepository _plexRepo; private readonly IPlexContentRepository _plexRepo;
private readonly IPlexContentSync _plexContentSync;
private readonly IEmbyContentRepository _embyRepo; private readonly IEmbyContentRepository _embyRepo;
private readonly IEmbyContentSync _embyContentSync; private readonly IEmbyContentSync _embyContentSync;

@ -50,9 +50,6 @@ namespace Ombi.Schedule.Jobs.Ombi
_emailSettings = emailSettings; _emailSettings = emailSettings;
_newsletterSettings = newsletter; _newsletterSettings = newsletter;
_userManager = um; _userManager = um;
_emailSettings.ClearCache();
_customizationSettings.ClearCache();
_newsletterSettings.ClearCache();
_log = log; _log = log;
_lidarrApi = lidarrApi; _lidarrApi = lidarrApi;
_lidarrAlbumRepository = albumCache; _lidarrAlbumRepository = albumCache;
@ -60,8 +57,6 @@ namespace Ombi.Schedule.Jobs.Ombi
_ombiSettings = ombiSettings; _ombiSettings = ombiSettings;
_plexSettings = plexSettings; _plexSettings = plexSettings;
_embySettings = embySettings; _embySettings = embySettings;
_ombiSettings.ClearCache();
_lidarrSettings.ClearCache();
} }
private readonly IPlexContentRepository _plex; private readonly IPlexContentRepository _plex;

@ -5,18 +5,13 @@ using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Http;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Hangfire; using Hangfire;
using Hangfire.Console;
using Hangfire.Server; using Hangfire.Server;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Ombi.Api.Service;
using Ombi.Api.Service.Models;
using Ombi.Core.Processor; using Ombi.Core.Processor;
using Ombi.Core.Settings; using Ombi.Core.Settings;
using Ombi.Helpers; using Ombi.Helpers;
@ -40,7 +35,6 @@ namespace Ombi.Schedule.Jobs.Ombi
Settings = s; Settings = s;
_processProvider = proc; _processProvider = proc;
_appConfig = appConfig; _appConfig = appConfig;
Settings.ClearCache();
} }
private ILogger<OmbiAutomaticUpdater> Logger { get; } private ILogger<OmbiAutomaticUpdater> Logger { get; }

@ -20,8 +20,6 @@ namespace Ombi.Schedule.Jobs.Ombi
_email = provider; _email = provider;
_templates = template; _templates = template;
_customizationSettings = c; _customizationSettings = c;
email.ClearCache();
_customizationSettings.ClearCache();
} }
private readonly ISettingsService<EmailNotificationSettings> _emailSettings; private readonly ISettingsService<EmailNotificationSettings> _emailSettings;

@ -57,7 +57,6 @@ namespace Ombi.Schedule.Jobs.Plex
EpisodeSync = epsiodeSync; EpisodeSync = epsiodeSync;
Metadata = metadataRefresh; Metadata = metadataRefresh;
Checker = checker; Checker = checker;
plex.ClearCache();
} }
private ISettingsService<PlexSettings> Plex { get; } private ISettingsService<PlexSettings> Plex { get; }

@ -26,7 +26,6 @@ namespace Ombi.Schedule.Jobs.Plex
_api = plexApi; _api = plexApi;
_repo = repo; _repo = repo;
_availabilityChecker = a; _availabilityChecker = a;
_settings.ClearCache();
} }
private readonly ISettingsService<PlexSettings> _settings; private readonly ISettingsService<PlexSettings> _settings;

@ -24,8 +24,6 @@ namespace Ombi.Schedule.Jobs.Plex
_log = log; _log = log;
_plexSettings = plexSettings; _plexSettings = plexSettings;
_userManagementSettings = ums; _userManagementSettings = ums;
_userManagementSettings.ClearCache();
_plexSettings.ClearCache();
} }
private readonly IPlexApi _api; private readonly IPlexApi _api;

@ -22,7 +22,6 @@ namespace Ombi.Schedule.Jobs.Radarr
RadarrApi = radarrApi; RadarrApi = radarrApi;
Logger = log; Logger = log;
_ctx = ctx; _ctx = ctx;
RadarrSettings.ClearCache();
} }
private ISettingsService<RadarrSettings> RadarrSettings { get; } private ISettingsService<RadarrSettings> RadarrSettings { get; }

@ -22,7 +22,6 @@ namespace Ombi.Schedule.Jobs.SickRage
_api = api; _api = api;
_log = l; _log = l;
_ctx = ctx; _ctx = ctx;
_settings.ClearCache();
} }
private readonly ISettingsService<SickRageSettings> _settings; private readonly ISettingsService<SickRageSettings> _settings;

@ -25,7 +25,6 @@ namespace Ombi.Schedule.Jobs.Sonarr
_api = api; _api = api;
_log = l; _log = l;
_ctx = ctx; _ctx = ctx;
_settings.ClearCache();
} }
private readonly ISettingsService<SonarrSettings> _settings; private readonly ISettingsService<SonarrSettings> _settings;

@ -61,7 +61,7 @@ namespace Ombi.Settings.Settings
var model = obj; var model = obj;
return model; return model;
}, DateTime.Now.AddHours(2)); }, DateTime.Now.AddHours(5));
} }
public bool SaveSettings(T model) public bool SaveSettings(T model)

@ -23,7 +23,6 @@ namespace Ombi.Controllers.External
RadarrApi = radarr; RadarrApi = radarr;
RadarrSettings = settings; RadarrSettings = settings;
Cache = mem; Cache = mem;
RadarrSettings.ClearCache();
} }
private IRadarrApi RadarrApi { get; } private IRadarrApi RadarrApi { get; }

@ -22,7 +22,6 @@ namespace Ombi.Controllers.External
SonarrApi = sonarr; SonarrApi = sonarr;
SonarrV3Api = sonarrv3; SonarrV3Api = sonarrv3;
SonarrSettings = settings; SonarrSettings = settings;
SonarrSettings.ClearCache();
} }
private ISonarrApi SonarrApi { get; } private ISonarrApi SonarrApi { get; }

Loading…
Cancel
Save