From b41fcb467e76a03f3d8c76de65f9234e7b601f30 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Sun, 10 Nov 2019 15:05:01 +0000 Subject: [PATCH] Removed hangfire completly from Ombi --- src/Ombi.Core/Ombi.Core.csproj | 1 - src/Ombi.DependencyInjection/IocExtensions.cs | 2 -- src/Ombi.Schedule.Tests/OmbiQuartzTests.cs | 1 + .../PlexAvailabilityCheckerTests.cs | 8 ++--- src/Ombi.Schedule/IoCJobActivator.cs | 28 ---------------- .../Jobs/Emby/EmbyAvaliabilityChecker.cs | 2 -- .../Jobs/Emby/EmbyContentSync.cs | 3 -- .../Jobs/Emby/EmbyEpisodeSync.cs | 1 - .../Jobs/Lidarr/LidarrAlbumSync.cs | 7 ++-- .../Jobs/Lidarr/LidarrArtistSync.cs | 7 ++-- .../Jobs/Lidarr/LidarrAvailabilityChecker.cs | 7 +--- .../Ombi/Interfaces/IOmbiAutomaticUpdater.cs | 1 - .../Jobs/Ombi/MediaDatabaseRefresh.cs | 2 -- .../Jobs/Ombi/OmbiAutomaticUpdater.cs | 2 -- .../Jobs/Ombi/RefreshMetadata.cs | 4 --- .../Jobs/Plex/PlexAvailabilityChecker.cs | 7 +--- .../Jobs/Plex/PlexContentSync.cs | 1 - .../Jobs/Plex/PlexEpisodeSync.cs | 1 - src/Ombi.Schedule/Ombi.Schedule.csproj | 6 ---- src/Ombi/Controllers/IdentityController.cs | 6 ++-- src/Ombi/Controllers/IssuesController.cs | 3 -- src/Ombi/Controllers/JobController.cs | 4 --- src/Ombi/Controllers/SettingsController.cs | 3 -- src/Ombi/Ombi.csproj | 5 --- src/Ombi/Startup.cs | 33 +------------------ 25 files changed, 15 insertions(+), 130 deletions(-) delete mode 100644 src/Ombi.Schedule/IoCJobActivator.cs diff --git a/src/Ombi.Core/Ombi.Core.csproj b/src/Ombi.Core/Ombi.Core.csproj index 790aa8500..8ffbd514a 100644 --- a/src/Ombi.Core/Ombi.Core.csproj +++ b/src/Ombi.Core/Ombi.Core.csproj @@ -11,7 +11,6 @@ - diff --git a/src/Ombi.DependencyInjection/IocExtensions.cs b/src/Ombi.DependencyInjection/IocExtensions.cs index c4e66c6f5..cec6bf4e3 100644 --- a/src/Ombi.DependencyInjection/IocExtensions.cs +++ b/src/Ombi.DependencyInjection/IocExtensions.cs @@ -1,6 +1,5 @@ using System.Diagnostics.CodeAnalysis; using System.Security.Principal; -using Hangfire; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; @@ -183,7 +182,6 @@ namespace Ombi.DependencyInjection { services.AddSingleton(); services.AddSingleton(); - services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/src/Ombi.Schedule.Tests/OmbiQuartzTests.cs b/src/Ombi.Schedule.Tests/OmbiQuartzTests.cs index 3c728300d..b5d94c15f 100644 --- a/src/Ombi.Schedule.Tests/OmbiQuartzTests.cs +++ b/src/Ombi.Schedule.Tests/OmbiQuartzTests.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using Quartz; using System.Threading; using System.Threading.Tasks; +using Ombi.Helpers; namespace Ombi.Schedule.Tests { diff --git a/src/Ombi.Schedule.Tests/PlexAvailabilityCheckerTests.cs b/src/Ombi.Schedule.Tests/PlexAvailabilityCheckerTests.cs index 028c044b7..b91ab59f6 100644 --- a/src/Ombi.Schedule.Tests/PlexAvailabilityCheckerTests.cs +++ b/src/Ombi.Schedule.Tests/PlexAvailabilityCheckerTests.cs @@ -4,9 +4,9 @@ using System.Linq; using System.Linq.Expressions; using System.Threading.Tasks; using Castle.Components.DictionaryAdapter; -using Hangfire; using Moq; using NUnit.Framework; +using Ombi.Core; using Ombi.Core.Notifications; using Ombi.Schedule.Jobs.Plex; using Ombi.Store.Entities; @@ -25,15 +25,15 @@ namespace Ombi.Schedule.Tests _repo = new Mock(); _tv = new Mock(); _movie = new Mock(); - _notify = new Mock(); - Checker = new PlexAvailabilityChecker(_repo.Object, _tv.Object, _movie.Object, _notify.Object, new Mock().Object, null); + _notify = new Mock(); + Checker = new PlexAvailabilityChecker(_repo.Object, _tv.Object, _movie.Object, _notify.Object, null); } private Mock _repo; private Mock _tv; private Mock _movie; - private Mock _notify; + private Mock _notify; private PlexAvailabilityChecker Checker; [Test] diff --git a/src/Ombi.Schedule/IoCJobActivator.cs b/src/Ombi.Schedule/IoCJobActivator.cs deleted file mode 100644 index 787ef8b6d..000000000 --- a/src/Ombi.Schedule/IoCJobActivator.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Linq; -using System.Reflection; -using Hangfire; -using Microsoft.Extensions.DependencyInjection; - -namespace Ombi.Schedule -{ - public class IoCJobActivator : JobActivator - { - private readonly IServiceProvider _container; - public IoCJobActivator(IServiceProvider container) - { - _container = container; - } - - public override object ActivateJob(Type type) - { - var scopeFactory = _container.GetService(); - var scope = scopeFactory.CreateScope(); - var scopedContainer = scope.ServiceProvider; - - var interfaceType = type.GetTypeInfo().ImplementedInterfaces.FirstOrDefault(); - var implementation = scopedContainer.GetRequiredService(interfaceType); - return implementation; - } - } -} \ No newline at end of file diff --git a/src/Ombi.Schedule/Jobs/Emby/EmbyAvaliabilityChecker.cs b/src/Ombi.Schedule/Jobs/Emby/EmbyAvaliabilityChecker.cs index ade23329d..baeb3c5c5 100644 --- a/src/Ombi.Schedule/Jobs/Emby/EmbyAvaliabilityChecker.cs +++ b/src/Ombi.Schedule/Jobs/Emby/EmbyAvaliabilityChecker.cs @@ -28,11 +28,9 @@ using System; using System.Linq; using System.Threading.Tasks; -using Hangfire; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Ombi.Core; -using Ombi.Core.Notifications; using Ombi.Helpers; using Ombi.Notifications.Models; using Ombi.Schedule.Jobs.Ombi; diff --git a/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs b/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs index 2d4b168af..34e697726 100644 --- a/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs +++ b/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs @@ -2,18 +2,15 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Hangfire; using Microsoft.Extensions.Logging; using Ombi.Api.Emby; using Ombi.Api.Emby.Models.Movie; using Ombi.Core.Settings; using Ombi.Core.Settings.Models.External; using Ombi.Helpers; -using Ombi.Schedule.Jobs.Ombi; using Ombi.Store.Entities; using Ombi.Store.Repository; using Quartz; -using Serilog; using EmbyMediaType = Ombi.Store.Entities.EmbyMediaType; namespace Ombi.Schedule.Jobs.Emby diff --git a/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeSync.cs b/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeSync.cs index 140d53b0a..1f67db4bc 100644 --- a/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeSync.cs +++ b/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeSync.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Hangfire; using Microsoft.Extensions.Logging; using Ombi.Api.Emby; using Ombi.Core.Settings; diff --git a/src/Ombi.Schedule/Jobs/Lidarr/LidarrAlbumSync.cs b/src/Ombi.Schedule/Jobs/Lidarr/LidarrAlbumSync.cs index 09bd787e7..f094d3f90 100644 --- a/src/Ombi.Schedule/Jobs/Lidarr/LidarrAlbumSync.cs +++ b/src/Ombi.Schedule/Jobs/Lidarr/LidarrAlbumSync.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Hangfire; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.Extensions.Logging; @@ -18,13 +17,12 @@ namespace Ombi.Schedule.Jobs.Lidarr public class LidarrAlbumSync : ILidarrAlbumSync { public LidarrAlbumSync(ISettingsService lidarr, ILidarrApi lidarrApi, ILogger log, ExternalContext ctx, - IBackgroundJobClient job, ILidarrAvailabilityChecker availability) + ILidarrAvailabilityChecker availability) { _lidarrSettings = lidarr; _lidarrApi = lidarrApi; _logger = log; _ctx = ctx; - _job = job; _availability = availability; } @@ -32,7 +30,6 @@ namespace Ombi.Schedule.Jobs.Lidarr private readonly ILidarrApi _lidarrApi; private readonly ILogger _logger; private readonly ExternalContext _ctx; - private readonly IBackgroundJobClient _job; private readonly ILidarrAvailabilityChecker _availability; public async Task CacheContent() @@ -87,7 +84,7 @@ namespace Ombi.Schedule.Jobs.Lidarr _logger.LogError(LoggingEvents.Cacher, ex, "Failed caching queued items from Lidarr Album"); } - _job.Enqueue(() => _availability.Start()); + await _availability.Start(); } } catch (Exception) diff --git a/src/Ombi.Schedule/Jobs/Lidarr/LidarrArtistSync.cs b/src/Ombi.Schedule/Jobs/Lidarr/LidarrArtistSync.cs index 317b5821e..61200d0e4 100644 --- a/src/Ombi.Schedule/Jobs/Lidarr/LidarrArtistSync.cs +++ b/src/Ombi.Schedule/Jobs/Lidarr/LidarrArtistSync.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Hangfire; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.Extensions.Logging; @@ -19,13 +18,12 @@ namespace Ombi.Schedule.Jobs.Lidarr public class LidarrArtistSync : ILidarrArtistSync { public LidarrArtistSync(ISettingsService lidarr, ILidarrApi lidarrApi, ILogger log, ExternalContext ctx, - IBackgroundJobClient background, ILidarrAlbumSync album) + ILidarrAlbumSync album) { _lidarrSettings = lidarr; _lidarrApi = lidarrApi; _logger = log; _ctx = ctx; - _job = background; _albumSync = album; } @@ -33,7 +31,6 @@ namespace Ombi.Schedule.Jobs.Lidarr private readonly ILidarrApi _lidarrApi; private readonly ILogger _logger; private readonly ExternalContext _ctx; - private readonly IBackgroundJobClient _job; private readonly ILidarrAlbumSync _albumSync; public async Task Execute(IJobExecutionContext job) @@ -84,7 +81,7 @@ namespace Ombi.Schedule.Jobs.Lidarr _logger.LogError(LoggingEvents.Cacher, ex, "Failed caching queued items from Lidarr"); } - _job.Enqueue(() => _albumSync.CacheContent()); + await _albumSync.CacheContent(); } } catch (Exception) diff --git a/src/Ombi.Schedule/Jobs/Lidarr/LidarrAvailabilityChecker.cs b/src/Ombi.Schedule/Jobs/Lidarr/LidarrAvailabilityChecker.cs index bdc697773..37abd68a2 100644 --- a/src/Ombi.Schedule/Jobs/Lidarr/LidarrAvailabilityChecker.cs +++ b/src/Ombi.Schedule/Jobs/Lidarr/LidarrAvailabilityChecker.cs @@ -2,11 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Hangfire; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Ombi.Core; -using Ombi.Core.Notifications; using Ombi.Helpers; using Ombi.Notifications.Models; using Ombi.Store.Entities; @@ -18,20 +16,17 @@ namespace Ombi.Schedule.Jobs.Lidarr { public class LidarrAvailabilityChecker : ILidarrAvailabilityChecker { - public LidarrAvailabilityChecker(IMusicRequestRepository requests, IRepository albums, ILogger log, - IBackgroundJobClient job, INotificationHelper notification) + public LidarrAvailabilityChecker(IMusicRequestRepository requests, IRepository albums, ILogger log, INotificationHelper notification) { _cachedAlbums = albums; _requestRepository = requests; _logger = log; - _job = job; _notificationService = notification; } private readonly IMusicRequestRepository _requestRepository; private readonly IRepository _cachedAlbums; private readonly ILogger _logger; - private readonly IBackgroundJobClient _job; private readonly INotificationHelper _notificationService; public async Task Start() diff --git a/src/Ombi.Schedule/Jobs/Ombi/Interfaces/IOmbiAutomaticUpdater.cs b/src/Ombi.Schedule/Jobs/Ombi/Interfaces/IOmbiAutomaticUpdater.cs index 484700c85..85765b6c6 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/Interfaces/IOmbiAutomaticUpdater.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/Interfaces/IOmbiAutomaticUpdater.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using Hangfire.Server; namespace Ombi.Schedule.Jobs.Ombi { diff --git a/src/Ombi.Schedule/Jobs/Ombi/MediaDatabaseRefresh.cs b/src/Ombi.Schedule/Jobs/Ombi/MediaDatabaseRefresh.cs index 9c1c8b638..6915b025d 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/MediaDatabaseRefresh.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/MediaDatabaseRefresh.cs @@ -1,8 +1,6 @@ using System; using System.Threading.Tasks; -using Hangfire; using Microsoft.Extensions.Logging; -using Ombi.Api.Plex; using Ombi.Core.Settings; using Ombi.Core.Settings.Models.External; using Ombi.Helpers; diff --git a/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs b/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs index 82187ed50..a6a7c5c76 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs @@ -9,8 +9,6 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; -using Hangfire; -using Hangfire.Server; using Microsoft.Extensions.Logging; using Ombi.Core.Processor; using Ombi.Core.Settings; diff --git a/src/Ombi.Schedule/Jobs/Ombi/RefreshMetadata.cs b/src/Ombi.Schedule/Jobs/Ombi/RefreshMetadata.cs index 7766119cc..3cc16952f 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/RefreshMetadata.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/RefreshMetadata.cs @@ -1,8 +1,6 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Hangfire; using Microsoft.Extensions.Logging; using Ombi.Api.Emby; using Ombi.Api.TheMovieDb; @@ -11,8 +9,6 @@ using Ombi.Api.TvMaze; using Ombi.Core.Settings; using Ombi.Core.Settings.Models.External; using Ombi.Helpers; -using Ombi.Schedule.Jobs.Emby; -using Ombi.Schedule.Jobs.Plex; using Ombi.Store.Entities; using Ombi.Store.Repository; using Quartz; diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexAvailabilityChecker.cs b/src/Ombi.Schedule/Jobs/Plex/PlexAvailabilityChecker.cs index 78fce3949..34643aa73 100644 --- a/src/Ombi.Schedule/Jobs/Plex/PlexAvailabilityChecker.cs +++ b/src/Ombi.Schedule/Jobs/Plex/PlexAvailabilityChecker.cs @@ -1,12 +1,9 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Hangfire; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Ombi.Core; -using Ombi.Core.Notifications; using Ombi.Helpers; using Ombi.Notifications.Models; using Ombi.Store.Entities; @@ -20,13 +17,12 @@ namespace Ombi.Schedule.Jobs.Plex public class PlexAvailabilityChecker : IPlexAvailabilityChecker { public PlexAvailabilityChecker(IPlexContentRepository repo, ITvRequestRepository tvRequest, IMovieRequestRepository movies, - INotificationHelper notification, IBackgroundJobClient background, ILogger log) + INotificationHelper notification, ILogger log) { _tvRepo = tvRequest; _repo = repo; _movieRepo = movies; _notificationService = notification; - _backgroundJobClient = background; _log = log; } @@ -34,7 +30,6 @@ namespace Ombi.Schedule.Jobs.Plex private readonly IMovieRequestRepository _movieRepo; private readonly IPlexContentRepository _repo; private readonly INotificationHelper _notificationService; - private readonly IBackgroundJobClient _backgroundJobClient; private readonly ILogger _log; public async Task Execute(IJobExecutionContext job) diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs b/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs index f290f2dc9..ee16b1efd 100644 --- a/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs +++ b/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Hangfire; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Ombi.Api.Plex; diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeSync.cs b/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeSync.cs index dcf5ea395..fe23e9a9f 100644 --- a/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeSync.cs +++ b/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeSync.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Hangfire; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Ombi.Api.Plex; diff --git a/src/Ombi.Schedule/Ombi.Schedule.csproj b/src/Ombi.Schedule/Ombi.Schedule.csproj index 14d3c5197..82111d45d 100644 --- a/src/Ombi.Schedule/Ombi.Schedule.csproj +++ b/src/Ombi.Schedule/Ombi.Schedule.csproj @@ -10,12 +10,6 @@ - - - - - - diff --git a/src/Ombi/Controllers/IdentityController.cs b/src/Ombi/Controllers/IdentityController.cs index e531ee6bc..76ff4565c 100644 --- a/src/Ombi/Controllers/IdentityController.cs +++ b/src/Ombi/Controllers/IdentityController.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Net; using System.Threading.Tasks; using AutoMapper; -using Hangfire; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; @@ -860,7 +859,7 @@ namespace Ombi.Controllers [HttpPost("welcomeEmail")] [PowerUser] - public void SendWelcomeEmail([FromBody] UserViewModel user) + public async Task SendWelcomeEmail([FromBody] UserViewModel user) { var ombiUser = new OmbiUser { @@ -868,7 +867,8 @@ namespace Ombi.Controllers Email = user.EmailAddress, UserName = user.UserName }; - BackgroundJob.Enqueue(() => WelcomeEmail.SendEmail(ombiUser)); + await WelcomeEmail.SendEmail(ombiUser); + return Ok(); } [HttpGet("accesstoken")] diff --git a/src/Ombi/Controllers/IssuesController.cs b/src/Ombi/Controllers/IssuesController.cs index 72d82fc25..d31aec647 100644 --- a/src/Ombi/Controllers/IssuesController.cs +++ b/src/Ombi/Controllers/IssuesController.cs @@ -6,17 +6,14 @@ using Ombi.Store.Entities.Requests; using Ombi.Store.Repository; using System.Collections.Generic; using System.Linq; -using Hangfire; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Ombi.Attributes; using Ombi.Core; -using Ombi.Core.Notifications; using Ombi.Helpers; using Ombi.Models; using Ombi.Notifications.Models; using Ombi.Store.Entities; -using StackExchange.Profiling.Helpers; namespace Ombi.Controllers { diff --git a/src/Ombi/Controllers/JobController.cs b/src/Ombi/Controllers/JobController.cs index 4171c2fa8..ab4dba5a1 100644 --- a/src/Ombi/Controllers/JobController.cs +++ b/src/Ombi/Controllers/JobController.cs @@ -1,13 +1,9 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Hangfire; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Caching.Memory; -using Ombi.Api.Service; using Ombi.Attributes; using Ombi.Helpers; -using Ombi.Schedule; using Ombi.Schedule.Jobs; using Ombi.Schedule.Jobs.Emby; using Ombi.Schedule.Jobs.Ombi; diff --git a/src/Ombi/Controllers/SettingsController.cs b/src/Ombi/Controllers/SettingsController.cs index 69dc08498..ed246806a 100644 --- a/src/Ombi/Controllers/SettingsController.cs +++ b/src/Ombi/Controllers/SettingsController.cs @@ -7,10 +7,8 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Threading.Tasks; using AutoMapper; -using Hangfire; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using NCrontab; using Ombi.Api.Emby; using Ombi.Attributes; using Ombi.Core.Models.UI; @@ -28,7 +26,6 @@ using Ombi.Store.Repository; using Ombi.Api.Github; using Ombi.Core.Engine; using Ombi.Extensions; -using Ombi.Schedule; using Quartz; namespace Ombi.Controllers diff --git a/src/Ombi/Ombi.csproj b/src/Ombi/Ombi.csproj index a5a3ed68e..b150b0244 100644 --- a/src/Ombi/Ombi.csproj +++ b/src/Ombi/Ombi.csproj @@ -65,11 +65,6 @@ - - - - - diff --git a/src/Ombi/Startup.cs b/src/Ombi/Startup.cs index f713fe31b..56e19bb11 100755 --- a/src/Ombi/Startup.cs +++ b/src/Ombi/Startup.cs @@ -2,10 +2,6 @@ using System.IO; using AutoMapper; using AutoMapper.EquivalencyExpression; -using Hangfire; -using Hangfire.Dashboard; -using Hangfire.MemoryStorage; -using Hangfire.SQLite; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpOverrides; @@ -93,13 +89,6 @@ namespace Ombi services.AddSwagger(); services.AddAppSettingsValues(Configuration); - services.AddHangfire(x => - { - x.UseMemoryStorage(); - x.UseActivator(new IoCJobActivator(services.BuildServiceProvider())); - }); - - services.AddCors(o => o.AddPolicy("MyPolicy", builder => { builder.AllowAnyOrigin() @@ -176,19 +165,7 @@ namespace Ombi app.UsePathBase(settings.BaseUrl); } - app.UseHangfireServer(new BackgroundJobServerOptions { WorkerCount = 1, ServerTimeout = TimeSpan.FromDays(1), ShutdownTimeout = TimeSpan.FromDays(1)}); - if (env.IsDevelopment()) - { - app.UseHangfireDashboard(settings.BaseUrl.HasValue() ? $"{settings.BaseUrl}/hangfire" : "/hangfire", - new DashboardOptions - { - Authorization = new[] { new HangfireAuthorizationFilter() } - }); - } - - GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute { Attempts = 3 }); - - // Setup the scheduler + // Setup the scheduler //var jobSetup = app.ApplicationServices.GetService(); //jobSetup.Setup(); ctx.Seed(); @@ -233,12 +210,4 @@ namespace Ombi }); } } - - public class HangfireAuthorizationFilter : IDashboardAuthorizationFilter - { - public bool Authorize(DashboardContext context) - { - return true; - } - } }