From da9c481bb40cd420b0758c4aec5e1a4abd1cda84 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Sat, 16 Feb 2019 22:39:00 +0000 Subject: [PATCH] Removed some areas where we clear out the cache. This should help with DB locking #2750 --- src/Ombi.Notifications/BaseNotification.cs | 4 ---- src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs | 1 - src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeSync.cs | 1 - src/Ombi.Schedule/Jobs/Emby/EmbyUserImporter.cs | 2 -- src/Ombi.Schedule/Jobs/Lidarr/LidarrAlbumSync.cs | 4 ---- src/Ombi.Schedule/Jobs/Lidarr/LidarrArtistSync.cs | 4 ---- src/Ombi.Schedule/Jobs/Ombi/MediaDatabaseRefresh.cs | 11 +++-------- src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs | 5 ----- src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs | 6 ------ src/Ombi.Schedule/Jobs/Ombi/WelcomeEmail.cs | 2 -- src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs | 1 - src/Ombi.Schedule/Jobs/Plex/PlexEpisodeSync.cs | 1 - src/Ombi.Schedule/Jobs/Plex/PlexUserImporter.cs | 2 -- src/Ombi.Schedule/Jobs/Radarr/RadarrSync.cs | 1 - src/Ombi.Schedule/Jobs/SickRage/SickRageSync.cs | 1 - src/Ombi.Schedule/Jobs/Sonarr/SonarrSync.cs | 1 - src/Ombi.Settings/Settings/SettingsService.cs | 2 +- src/Ombi/Controllers/External/RadarrController.cs | 1 - src/Ombi/Controllers/External/SonarrController.cs | 1 - 19 files changed, 4 insertions(+), 47 deletions(-) diff --git a/src/Ombi.Notifications/BaseNotification.cs b/src/Ombi.Notifications/BaseNotification.cs index 57eafedd9..001f68f45 100644 --- a/src/Ombi.Notifications/BaseNotification.cs +++ b/src/Ombi.Notifications/BaseNotification.cs @@ -26,8 +26,6 @@ namespace Ombi.Notifications MovieRepository = movie; TvRepository = tv; CustomizationSettings = customization; - Settings.ClearCache(); - CustomizationSettings.ClearCache(); RequestSubscription = sub; _log = log; AlbumRepository = album; @@ -55,14 +53,12 @@ namespace Ombi.Notifications public async Task NotifyAsync(NotificationOptions model) { - Settings.ClearCache(); var configuration = await GetConfiguration(); await NotifyAsync(model, configuration); } public async Task NotifyAsync(NotificationOptions model, Settings.Settings.Models.Settings settings) { - Settings.ClearCache(); if (settings == null) await NotifyAsync(model); var notificationSettings = (T)settings; diff --git a/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs b/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs index 4972f940f..e22c0ca51 100644 --- a/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs +++ b/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs @@ -28,7 +28,6 @@ namespace Ombi.Schedule.Jobs.Emby _repo = repo; _episodeSync = epSync; _metadata = metadata; - _settings.ClearCache(); } private readonly ILogger _logger; diff --git a/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeSync.cs b/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeSync.cs index 2bb417d3d..962b08cda 100644 --- a/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeSync.cs +++ b/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeSync.cs @@ -49,7 +49,6 @@ namespace Ombi.Schedule.Jobs.Emby _settings = s; _repo = repo; _avaliabilityChecker = checker; - _settings.ClearCache(); } private readonly ISettingsService _settings; diff --git a/src/Ombi.Schedule/Jobs/Emby/EmbyUserImporter.cs b/src/Ombi.Schedule/Jobs/Emby/EmbyUserImporter.cs index 2dadd4bd4..280a61ab4 100644 --- a/src/Ombi.Schedule/Jobs/Emby/EmbyUserImporter.cs +++ b/src/Ombi.Schedule/Jobs/Emby/EmbyUserImporter.cs @@ -50,8 +50,6 @@ namespace Ombi.Schedule.Jobs.Emby _log = log; _embySettings = embySettings; _userManagementSettings = ums; - _userManagementSettings.ClearCache(); - _embySettings.ClearCache(); } private readonly IEmbyApi _api; diff --git a/src/Ombi.Schedule/Jobs/Lidarr/LidarrAlbumSync.cs b/src/Ombi.Schedule/Jobs/Lidarr/LidarrAlbumSync.cs index d19fe561a..2a50b5b38 100644 --- a/src/Ombi.Schedule/Jobs/Lidarr/LidarrAlbumSync.cs +++ b/src/Ombi.Schedule/Jobs/Lidarr/LidarrAlbumSync.cs @@ -1,19 +1,16 @@ using System; using System.Collections.Generic; -using System.Threading; using System.Threading.Tasks; using Hangfire; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.Extensions.Logging; using Ombi.Api.Lidarr; -using Ombi.Api.Radarr; using Ombi.Core.Settings; using Ombi.Helpers; using Ombi.Settings.Settings.Models.External; using Ombi.Store.Context; using Ombi.Store.Entities; -using Serilog; using ILogger = Microsoft.Extensions.Logging.ILogger; namespace Ombi.Schedule.Jobs.Lidarr @@ -29,7 +26,6 @@ namespace Ombi.Schedule.Jobs.Lidarr _ctx = ctx; _job = job; _availability = availability; - _lidarrSettings.ClearCache(); } private readonly ISettingsService _lidarrSettings; diff --git a/src/Ombi.Schedule/Jobs/Lidarr/LidarrArtistSync.cs b/src/Ombi.Schedule/Jobs/Lidarr/LidarrArtistSync.cs index 4117ee44a..e9a64f2a3 100644 --- a/src/Ombi.Schedule/Jobs/Lidarr/LidarrArtistSync.cs +++ b/src/Ombi.Schedule/Jobs/Lidarr/LidarrArtistSync.cs @@ -1,19 +1,16 @@ using System; using System.Collections.Generic; -using System.Threading; using System.Threading.Tasks; using Hangfire; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.Extensions.Logging; using Ombi.Api.Lidarr; -using Ombi.Api.Radarr; using Ombi.Core.Settings; using Ombi.Helpers; using Ombi.Settings.Settings.Models.External; using Ombi.Store.Context; using Ombi.Store.Entities; -using Serilog; using ILogger = Microsoft.Extensions.Logging.ILogger; namespace Ombi.Schedule.Jobs.Lidarr @@ -29,7 +26,6 @@ namespace Ombi.Schedule.Jobs.Lidarr _ctx = ctx; _job = background; _albumSync = album; - _lidarrSettings.ClearCache(); } private readonly ISettingsService _lidarrSettings; diff --git a/src/Ombi.Schedule/Jobs/Ombi/MediaDatabaseRefresh.cs b/src/Ombi.Schedule/Jobs/Ombi/MediaDatabaseRefresh.cs index baa7fdcae..ed0bf227f 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/MediaDatabaseRefresh.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/MediaDatabaseRefresh.cs @@ -10,28 +10,23 @@ using Ombi.Schedule.Jobs.Emby; using Ombi.Schedule.Jobs.Plex.Interfaces; using Ombi.Store.Repository; -namespace Ombi.Schedule.Jobs.Plex +namespace Ombi.Schedule.Jobs.Ombi { public class MediaDatabaseRefresh : IMediaDatabaseRefresh { - public MediaDatabaseRefresh(ISettingsService s, ILogger log, IPlexApi plexApi, - IPlexContentRepository plexRepo, IPlexContentSync c, IEmbyContentRepository embyRepo, IEmbyContentSync embySync) + public MediaDatabaseRefresh(ISettingsService s, ILogger log, + IPlexContentRepository plexRepo, IEmbyContentRepository embyRepo, IEmbyContentSync embySync) { _settings = s; _log = log; - _api = plexApi; _plexRepo = plexRepo; - _plexContentSync = c; _embyRepo = embyRepo; _embyContentSync = embySync; - _settings.ClearCache(); } private readonly ISettingsService _settings; private readonly ILogger _log; - private readonly IPlexApi _api; private readonly IPlexContentRepository _plexRepo; - private readonly IPlexContentSync _plexContentSync; private readonly IEmbyContentRepository _embyRepo; private readonly IEmbyContentSync _embyContentSync; diff --git a/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs b/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs index 3374a7c7b..6c59f4c0f 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs @@ -50,9 +50,6 @@ namespace Ombi.Schedule.Jobs.Ombi _emailSettings = emailSettings; _newsletterSettings = newsletter; _userManager = um; - _emailSettings.ClearCache(); - _customizationSettings.ClearCache(); - _newsletterSettings.ClearCache(); _log = log; _lidarrApi = lidarrApi; _lidarrAlbumRepository = albumCache; @@ -60,8 +57,6 @@ namespace Ombi.Schedule.Jobs.Ombi _ombiSettings = ombiSettings; _plexSettings = plexSettings; _embySettings = embySettings; - _ombiSettings.ClearCache(); - _lidarrSettings.ClearCache(); } private readonly IPlexContentRepository _plex; diff --git a/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs b/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs index 5ec8978b6..783fe5f9d 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs @@ -5,18 +5,13 @@ using System.IO; using System.IO.Compression; using System.Linq; using System.Net; -using System.Net.Http; using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using Hangfire; -using Hangfire.Console; using Hangfire.Server; using Microsoft.Extensions.Logging; - -using Ombi.Api.Service; -using Ombi.Api.Service.Models; using Ombi.Core.Processor; using Ombi.Core.Settings; using Ombi.Helpers; @@ -40,7 +35,6 @@ namespace Ombi.Schedule.Jobs.Ombi Settings = s; _processProvider = proc; _appConfig = appConfig; - Settings.ClearCache(); } private ILogger Logger { get; } diff --git a/src/Ombi.Schedule/Jobs/Ombi/WelcomeEmail.cs b/src/Ombi.Schedule/Jobs/Ombi/WelcomeEmail.cs index e260ebed3..f98072e9e 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/WelcomeEmail.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/WelcomeEmail.cs @@ -20,8 +20,6 @@ namespace Ombi.Schedule.Jobs.Ombi _email = provider; _templates = template; _customizationSettings = c; - email.ClearCache(); - _customizationSettings.ClearCache(); } private readonly ISettingsService _emailSettings; diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs b/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs index c39b80c1f..964832b44 100644 --- a/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs +++ b/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs @@ -57,7 +57,6 @@ namespace Ombi.Schedule.Jobs.Plex EpisodeSync = epsiodeSync; Metadata = metadataRefresh; Checker = checker; - plex.ClearCache(); } private ISettingsService Plex { get; } diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeSync.cs b/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeSync.cs index 5652d126b..6ab5a5941 100644 --- a/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeSync.cs +++ b/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeSync.cs @@ -26,7 +26,6 @@ namespace Ombi.Schedule.Jobs.Plex _api = plexApi; _repo = repo; _availabilityChecker = a; - _settings.ClearCache(); } private readonly ISettingsService _settings; diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexUserImporter.cs b/src/Ombi.Schedule/Jobs/Plex/PlexUserImporter.cs index 4f6bf2550..105e8876d 100644 --- a/src/Ombi.Schedule/Jobs/Plex/PlexUserImporter.cs +++ b/src/Ombi.Schedule/Jobs/Plex/PlexUserImporter.cs @@ -24,8 +24,6 @@ namespace Ombi.Schedule.Jobs.Plex _log = log; _plexSettings = plexSettings; _userManagementSettings = ums; - _userManagementSettings.ClearCache(); - _plexSettings.ClearCache(); } private readonly IPlexApi _api; diff --git a/src/Ombi.Schedule/Jobs/Radarr/RadarrSync.cs b/src/Ombi.Schedule/Jobs/Radarr/RadarrSync.cs index 5c954def8..f61747ac6 100644 --- a/src/Ombi.Schedule/Jobs/Radarr/RadarrSync.cs +++ b/src/Ombi.Schedule/Jobs/Radarr/RadarrSync.cs @@ -22,7 +22,6 @@ namespace Ombi.Schedule.Jobs.Radarr RadarrApi = radarrApi; Logger = log; _ctx = ctx; - RadarrSettings.ClearCache(); } private ISettingsService RadarrSettings { get; } diff --git a/src/Ombi.Schedule/Jobs/SickRage/SickRageSync.cs b/src/Ombi.Schedule/Jobs/SickRage/SickRageSync.cs index 92e0c2d55..2c8d03b1d 100644 --- a/src/Ombi.Schedule/Jobs/SickRage/SickRageSync.cs +++ b/src/Ombi.Schedule/Jobs/SickRage/SickRageSync.cs @@ -22,7 +22,6 @@ namespace Ombi.Schedule.Jobs.SickRage _api = api; _log = l; _ctx = ctx; - _settings.ClearCache(); } private readonly ISettingsService _settings; diff --git a/src/Ombi.Schedule/Jobs/Sonarr/SonarrSync.cs b/src/Ombi.Schedule/Jobs/Sonarr/SonarrSync.cs index e4c00c726..c77e23394 100644 --- a/src/Ombi.Schedule/Jobs/Sonarr/SonarrSync.cs +++ b/src/Ombi.Schedule/Jobs/Sonarr/SonarrSync.cs @@ -25,7 +25,6 @@ namespace Ombi.Schedule.Jobs.Sonarr _api = api; _log = l; _ctx = ctx; - _settings.ClearCache(); } private readonly ISettingsService _settings; diff --git a/src/Ombi.Settings/Settings/SettingsService.cs b/src/Ombi.Settings/Settings/SettingsService.cs index 3162c34c2..57ae482a2 100644 --- a/src/Ombi.Settings/Settings/SettingsService.cs +++ b/src/Ombi.Settings/Settings/SettingsService.cs @@ -61,7 +61,7 @@ namespace Ombi.Settings.Settings var model = obj; return model; - }, DateTime.Now.AddHours(2)); + }, DateTime.Now.AddHours(5)); } public bool SaveSettings(T model) diff --git a/src/Ombi/Controllers/External/RadarrController.cs b/src/Ombi/Controllers/External/RadarrController.cs index 623322704..b630244f6 100644 --- a/src/Ombi/Controllers/External/RadarrController.cs +++ b/src/Ombi/Controllers/External/RadarrController.cs @@ -23,7 +23,6 @@ namespace Ombi.Controllers.External RadarrApi = radarr; RadarrSettings = settings; Cache = mem; - RadarrSettings.ClearCache(); } private IRadarrApi RadarrApi { get; } diff --git a/src/Ombi/Controllers/External/SonarrController.cs b/src/Ombi/Controllers/External/SonarrController.cs index bc2534ab8..fd3e169bc 100644 --- a/src/Ombi/Controllers/External/SonarrController.cs +++ b/src/Ombi/Controllers/External/SonarrController.cs @@ -22,7 +22,6 @@ namespace Ombi.Controllers.External SonarrApi = sonarr; SonarrV3Api = sonarrv3; SonarrSettings = settings; - SonarrSettings.ClearCache(); } private ISonarrApi SonarrApi { get; }