More memory management and improvements

pull/1882/head
tidusjar 7 years ago
parent 835be4385b
commit 96cf4388bc

@ -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);
}
}
}

@ -2,7 +2,7 @@
namespace Ombi.Schedule.Jobs.Couchpotato
{
public interface ICouchPotatoSync
public interface ICouchPotatoSync : IBaseJob
{
Task Start();
}

@ -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();

@ -3,7 +3,7 @@ using Ombi.Store.Entities;
namespace Ombi.Schedule.Jobs.Ombi
{
public interface IWelcomeEmail
public interface IWelcomeEmail : IBaseJob
{
Task SendEmail(OmbiUser user);
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -4,7 +4,7 @@ using Ombi.Store.Entities;
namespace Ombi.Schedule.Jobs.Radarr
{
public interface IRadarrSync
public interface IRadarrSync : IBaseJob
{
Task CacheContent();
Task<IEnumerable<RadarrCache>> GetCachedContent();

@ -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);
}
}
}

@ -2,7 +2,7 @@
namespace Ombi.Schedule.Jobs.SickRage
{
public interface ISickRageSync
public interface ISickRageSync : IBaseJob
{
Task Start();
}

@ -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);
}
}
}

@ -2,7 +2,7 @@
namespace Ombi.Schedule.Jobs.Sonarr
{
public interface ISonarrSync
public interface ISonarrSync : IBaseJob
{
Task Start();
}

@ -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);
}
}
}
Loading…
Cancel
Save