From d79657deb194f95a05ab225b5c95b8b2fdb342bc Mon Sep 17 00:00:00 2001 From: da3dsoul Date: Wed, 10 Jan 2024 10:31:36 -0500 Subject: [PATCH] Make Jobs easier to run Ad-hoc by removing the IJobExecutionContext from Process() --- Shoko.Server/Scheduling/Jobs/AniDB/AniDBGetFileJob.cs | 2 +- Shoko.Server/Scheduling/Jobs/BaseJob.cs | 4 ++-- Shoko.Server/Scheduling/Jobs/Shoko/DiscoverFileJob.cs | 2 +- Shoko.Server/Scheduling/Jobs/Shoko/HashFileJob.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Shoko.Server/Scheduling/Jobs/AniDB/AniDBGetFileJob.cs b/Shoko.Server/Scheduling/Jobs/AniDB/AniDBGetFileJob.cs index c6650aefc..5be1ef415 100644 --- a/Shoko.Server/Scheduling/Jobs/AniDB/AniDBGetFileJob.cs +++ b/Shoko.Server/Scheduling/Jobs/AniDB/AniDBGetFileJob.cs @@ -56,7 +56,7 @@ public override QueueStateStruct Description } } - protected override async Task Process(IJobExecutionContext context) + public override async Task Process() { Logger.LogInformation("Get AniDB file info: {VideoLocalID}", VideoLocalID); diff --git a/Shoko.Server/Scheduling/Jobs/BaseJob.cs b/Shoko.Server/Scheduling/Jobs/BaseJob.cs index ef65e52e6..be8e3943e 100644 --- a/Shoko.Server/Scheduling/Jobs/BaseJob.cs +++ b/Shoko.Server/Scheduling/Jobs/BaseJob.cs @@ -17,7 +17,7 @@ public async Task Execute(IJobExecutionContext context) { try { - await Process(context); + await Process(); } catch (Exception ex) { @@ -25,7 +25,7 @@ public async Task Execute(IJobExecutionContext context) } } - protected abstract Task Process(IJobExecutionContext context); + public abstract Task Process(); [XmlIgnore][JsonIgnore] protected readonly ILogger Logger; [XmlIgnore][JsonIgnore] public abstract QueueStateStruct Description { get; } diff --git a/Shoko.Server/Scheduling/Jobs/Shoko/DiscoverFileJob.cs b/Shoko.Server/Scheduling/Jobs/Shoko/DiscoverFileJob.cs index 447abba41..21fd9f3ce 100644 --- a/Shoko.Server/Scheduling/Jobs/Shoko/DiscoverFileJob.cs +++ b/Shoko.Server/Scheduling/Jobs/Shoko/DiscoverFileJob.cs @@ -39,7 +39,7 @@ public DiscoverFileJob(ILoggerFactory loggerFactory, ISettingsProvider settingsP protected DiscoverFileJob() { } - protected override async Task Process(IJobExecutionContext context) + public override async Task Process() { // The flow has changed. // Check for previous existence, merge info if needed diff --git a/Shoko.Server/Scheduling/Jobs/Shoko/HashFileJob.cs b/Shoko.Server/Scheduling/Jobs/Shoko/HashFileJob.cs index d5b8075ed..dbce36d70 100644 --- a/Shoko.Server/Scheduling/Jobs/Shoko/HashFileJob.cs +++ b/Shoko.Server/Scheduling/Jobs/Shoko/HashFileJob.cs @@ -48,7 +48,7 @@ public HashFileJob(ILoggerFactory loggerFactory, ISettingsProvider settingsProvi protected HashFileJob() { } - protected override async Task Process(IJobExecutionContext context) + public override async Task Process() { var (shouldSave, vlocal, vlocalplace, folder) = GetVideoLocal(); Exception e = null;