mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 21:33:15 -07:00
Moved the RecentlyAddedSync into it's own job, it still is calls the regular sync but this should make it easier to start the job from the UI (When I add that)
This commit is contained in:
parent
5529a049d6
commit
856ec03377
4 changed files with 54 additions and 2 deletions
|
@ -177,6 +177,7 @@ namespace Ombi.DependencyInjection
|
|||
services.AddTransient<ISickRageSync, SickRageSync>();
|
||||
services.AddTransient<IRefreshMetadata, RefreshMetadata>();
|
||||
services.AddTransient<INewsletterJob, NewsletterJob>();
|
||||
services.AddTransient<IPlexRecentlyAddedSync, PlexRecentlyAddedSync>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Ombi.Schedule
|
|||
IOmbiAutomaticUpdater updater, IEmbyContentSync embySync, IPlexUserImporter userImporter,
|
||||
IEmbyUserImporter embyUserImporter, ISonarrSync cache, ICouchPotatoSync cpCache,
|
||||
ISettingsService<JobSettings> jobsettings, ISickRageSync srSync, IRefreshMetadata refresh,
|
||||
INewsletterJob newsletter)
|
||||
INewsletterJob newsletter, IPlexRecentlyAddedSync recentlyAddedPlex)
|
||||
{
|
||||
_plexContentSync = plexContentSync;
|
||||
_radarrSync = radarrSync;
|
||||
|
@ -33,9 +33,11 @@ namespace Ombi.Schedule
|
|||
_srSync = srSync;
|
||||
_refreshMetadata = refresh;
|
||||
_newsletter = newsletter;
|
||||
_plexRecentlyAddedSync = recentlyAddedPlex;
|
||||
}
|
||||
|
||||
private readonly IPlexContentSync _plexContentSync;
|
||||
private readonly IPlexRecentlyAddedSync _plexRecentlyAddedSync;
|
||||
private readonly IRadarrSync _radarrSync;
|
||||
private readonly IOmbiAutomaticUpdater _updater;
|
||||
private readonly IPlexUserImporter _plexUserImporter;
|
||||
|
@ -56,7 +58,7 @@ namespace Ombi.Schedule
|
|||
RecurringJob.AddOrUpdate(() => _sonarrSync.Start(), JobSettingsHelper.Sonarr(s));
|
||||
RecurringJob.AddOrUpdate(() => _radarrSync.CacheContent(), JobSettingsHelper.Radarr(s));
|
||||
RecurringJob.AddOrUpdate(() => _plexContentSync.CacheContent(false), JobSettingsHelper.PlexContent(s));
|
||||
RecurringJob.AddOrUpdate(() => _plexContentSync.CacheContent(true), JobSettingsHelper.PlexRecentlyAdded(s));
|
||||
RecurringJob.AddOrUpdate(() => _plexRecentlyAddedSync.Start(), JobSettingsHelper.PlexRecentlyAdded(s));
|
||||
RecurringJob.AddOrUpdate(() => _cpCache.Start(), JobSettingsHelper.CouchPotato(s));
|
||||
RecurringJob.AddOrUpdate(() => _srSync.Start(), JobSettingsHelper.SickRageSync(s));
|
||||
RecurringJob.AddOrUpdate(() => _refreshMetadata.Start(), JobSettingsHelper.RefreshMetadata(s));
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ombi.Schedule.Jobs.Plex
|
||||
{
|
||||
public interface IPlexRecentlyAddedSync : IBaseJob
|
||||
{
|
||||
void Start();
|
||||
}
|
||||
}
|
40
src/Ombi.Schedule/Jobs/Plex/PlexRecentlyAddedSync.cs
Normal file
40
src/Ombi.Schedule/Jobs/Plex/PlexRecentlyAddedSync.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Hangfire;
|
||||
|
||||
namespace Ombi.Schedule.Jobs.Plex
|
||||
{
|
||||
public class PlexRecentlyAddedSync : IPlexRecentlyAddedSync
|
||||
{
|
||||
public PlexRecentlyAddedSync(IPlexContentSync sync)
|
||||
{
|
||||
_sync = sync;
|
||||
}
|
||||
|
||||
private readonly IPlexContentSync _sync;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
BackgroundJob.Enqueue(() => _sync.CacheContent(true));
|
||||
}
|
||||
|
||||
private bool _disposed;
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (_disposed)
|
||||
return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
_sync?.Dispose();
|
||||
}
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue