diff --git a/src/Ombi.Schedule/Jobs/Couchpotato/CouchPotatoSync.cs b/src/Ombi.Schedule/Jobs/Couchpotato/CouchPotatoSync.cs index 21be476cd..8606de371 100644 --- a/src/Ombi.Schedule/Jobs/Couchpotato/CouchPotatoSync.cs +++ b/src/Ombi.Schedule/Jobs/Couchpotato/CouchPotatoSync.cs @@ -102,5 +102,25 @@ namespace Ombi.Schedule.Jobs.Couchpotato throw; } } + + private bool _disposed; + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + _settings?.Dispose(); + _ctx?.Dispose(); + } + _disposed = true; + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } } } \ No newline at end of file diff --git a/src/Ombi.Schedule/Jobs/Couchpotato/ICouchPotatoSync.cs b/src/Ombi.Schedule/Jobs/Couchpotato/ICouchPotatoSync.cs index 190819754..caa390834 100644 --- a/src/Ombi.Schedule/Jobs/Couchpotato/ICouchPotatoSync.cs +++ b/src/Ombi.Schedule/Jobs/Couchpotato/ICouchPotatoSync.cs @@ -2,7 +2,7 @@ namespace Ombi.Schedule.Jobs.Couchpotato { - public interface ICouchPotatoSync + public interface ICouchPotatoSync : IBaseJob { Task Start(); } diff --git a/src/Ombi.Schedule/Jobs/Ombi/IOmbiAutomaticUpdater.cs b/src/Ombi.Schedule/Jobs/Ombi/IOmbiAutomaticUpdater.cs index f40df76eb..48f03b65d 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/IOmbiAutomaticUpdater.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/IOmbiAutomaticUpdater.cs @@ -3,7 +3,7 @@ using Hangfire.Server; namespace Ombi.Schedule.Jobs.Ombi { - public interface IOmbiAutomaticUpdater + public interface IOmbiAutomaticUpdater : IBaseJob { Task Update(PerformContext context); string[] GetVersion(); diff --git a/src/Ombi.Schedule/Jobs/Ombi/IWelcomeEmail.cs b/src/Ombi.Schedule/Jobs/Ombi/IWelcomeEmail.cs index b4be7cbef..6b1270669 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/IWelcomeEmail.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/IWelcomeEmail.cs @@ -3,7 +3,7 @@ using Ombi.Store.Entities; namespace Ombi.Schedule.Jobs.Ombi { - public interface IWelcomeEmail + public interface IWelcomeEmail : IBaseJob { Task SendEmail(OmbiUser user); } diff --git a/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs b/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs index 667dbd5f0..bac3ddfca 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs @@ -315,5 +315,25 @@ namespace Ombi.Schedule.Jobs.Ombi await client.DownloadFileTaskAsync(requestUri, filename); } } + + private bool _disposed; + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + _appConfig?.Dispose(); + Settings?.Dispose(); + } + _disposed = true; + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } } } \ No newline at end of file diff --git a/src/Ombi.Schedule/Jobs/Ombi/WelcomeEmail.cs b/src/Ombi.Schedule/Jobs/Ombi/WelcomeEmail.cs index bfd948e68..e260ebed3 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/WelcomeEmail.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/WelcomeEmail.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; using Ombi.Core.Settings; using Ombi.Helpers; using Ombi.Notifications; @@ -62,5 +63,25 @@ namespace Ombi.Schedule.Jobs.Ombi return parsed; } + + private bool _disposed; + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + _emailSettings?.Dispose(); + _customizationSettings?.Dispose(); + } + _disposed = true; + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } } } \ No newline at end of file diff --git a/src/Ombi.Schedule/Jobs/Radarr/IRadarrSync.cs b/src/Ombi.Schedule/Jobs/Radarr/IRadarrSync.cs index bcf6539e0..a9f8edfcd 100644 --- a/src/Ombi.Schedule/Jobs/Radarr/IRadarrSync.cs +++ b/src/Ombi.Schedule/Jobs/Radarr/IRadarrSync.cs @@ -4,7 +4,7 @@ using Ombi.Store.Entities; namespace Ombi.Schedule.Jobs.Radarr { - public interface IRadarrSync + public interface IRadarrSync : IBaseJob { Task CacheContent(); Task> GetCachedContent(); diff --git a/src/Ombi.Schedule/Jobs/Radarr/RadarrSync.cs b/src/Ombi.Schedule/Jobs/Radarr/RadarrSync.cs index a547b3c2a..0aea8cdc2 100644 --- a/src/Ombi.Schedule/Jobs/Radarr/RadarrSync.cs +++ b/src/Ombi.Schedule/Jobs/Radarr/RadarrSync.cs @@ -89,5 +89,25 @@ namespace Ombi.Schedule.Jobs.Radarr { return await _ctx.RadarrCache.ToListAsync(); } + + private bool _disposed; + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + _ctx?.Dispose(); + RadarrSettings?.Dispose(); + } + _disposed = true; + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } } } \ No newline at end of file diff --git a/src/Ombi.Schedule/Jobs/SickRage/ISickRageSync.cs b/src/Ombi.Schedule/Jobs/SickRage/ISickRageSync.cs index 2127dca5e..df51698fe 100644 --- a/src/Ombi.Schedule/Jobs/SickRage/ISickRageSync.cs +++ b/src/Ombi.Schedule/Jobs/SickRage/ISickRageSync.cs @@ -2,7 +2,7 @@ namespace Ombi.Schedule.Jobs.SickRage { - public interface ISickRageSync + public interface ISickRageSync : IBaseJob { Task Start(); } diff --git a/src/Ombi.Schedule/Jobs/SickRage/SickRageSync.cs b/src/Ombi.Schedule/Jobs/SickRage/SickRageSync.cs index 6e373ed58..690b82219 100644 --- a/src/Ombi.Schedule/Jobs/SickRage/SickRageSync.cs +++ b/src/Ombi.Schedule/Jobs/SickRage/SickRageSync.cs @@ -88,5 +88,25 @@ namespace Ombi.Schedule.Jobs.SickRage SemaphoreSlim.Release(); } } + + private bool _disposed; + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + _settings?.Dispose(); + _ctx?.Dispose(); + } + _disposed = true; + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } } } \ No newline at end of file diff --git a/src/Ombi.Schedule/Jobs/Sonarr/ISonarrSync.cs b/src/Ombi.Schedule/Jobs/Sonarr/ISonarrSync.cs index 4d675b496..a1ba9f3c2 100644 --- a/src/Ombi.Schedule/Jobs/Sonarr/ISonarrSync.cs +++ b/src/Ombi.Schedule/Jobs/Sonarr/ISonarrSync.cs @@ -2,7 +2,7 @@ namespace Ombi.Schedule.Jobs.Sonarr { - public interface ISonarrSync + public interface ISonarrSync : IBaseJob { Task Start(); } diff --git a/src/Ombi.Schedule/Jobs/Sonarr/SonarrSync.cs b/src/Ombi.Schedule/Jobs/Sonarr/SonarrSync.cs index 55b65346d..d8d82ea08 100644 --- a/src/Ombi.Schedule/Jobs/Sonarr/SonarrSync.cs +++ b/src/Ombi.Schedule/Jobs/Sonarr/SonarrSync.cs @@ -84,5 +84,25 @@ namespace Ombi.Schedule.Jobs.Sonarr SemaphoreSlim.Release(); } } + + private bool _disposed; + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + _settings?.Dispose(); + _ctx?.Dispose(); + } + _disposed = true; + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } } } \ No newline at end of file