Skip to content

Commit

Permalink
Create Attributes for Determining Acquisition Requirements and Annota…
Browse files Browse the repository at this point in the history
…te the Existing Jobs
  • Loading branch information
da3dsoul committed Jan 10, 2024
1 parent d79657d commit 4003bd3
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using System;

namespace Shoko.Server.Scheduling.Acquisition;

public class AniDBHTTPRateLimitedAttribute : Attribute { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using System;

namespace Shoko.Server.Scheduling.Acquisition;

public class AniDBUDPRateLimitedAttribute : Attribute { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using System;

namespace Shoko.Server.Scheduling.Acquisition;

[AttributeUsage(AttributeTargets.Class)]
public class DatabaseRequiredAttribute : Attribute { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using System;

namespace Shoko.Server.Scheduling.Acquisition;

[AttributeUsage(AttributeTargets.Class)]
public class NetworkRequiredAttribute : Attribute { }
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Shoko.Server.Scheduling.Jobs.Actions;

[JobKeyMember("UptimeMonitor")]
[JobKeyGroup("System")]
[JobKeyGroup(JobKeyGroup.System)]
[DisallowConcurrentExecution]
public class CheckNetworkAvailabilityJob : IJob
{
Expand Down
4 changes: 3 additions & 1 deletion Shoko.Server/Scheduling/Jobs/Actions/ImportJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
using System.Threading.Tasks;
using Quartz;
using QuartzJobFactory.Attributes;
using Shoko.Server.Scheduling.Acquisition;

namespace Shoko.Server.Scheduling.Jobs.Actions;

[DatabaseRequired]
[JobKeyMember("Import")]
[JobKeyGroup("Legacy")]
[JobKeyGroup(JobKeyGroup.Legacy)]
[DisallowConcurrentExecution]
internal class ImportJob : IJob
{
Expand Down
4 changes: 3 additions & 1 deletion Shoko.Server/Scheduling/Jobs/Actions/MediaInfoJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
using QuartzJobFactory.Attributes;
using Shoko.Server.Commands;
using Shoko.Server.Repositories;
using Shoko.Server.Scheduling.Acquisition;

namespace Shoko.Server.Scheduling.Jobs.Actions;

[DatabaseRequired]
[JobKeyMember("MediaInfo")]
[JobKeyGroup("Legacy")]
[JobKeyGroup(JobKeyGroup.Legacy)]
internal class MediaInfoJob : IJob
{
private readonly ICommandRequestFactory _commandRequestFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
using System.Threading.Tasks;
using Quartz;
using QuartzJobFactory.Attributes;
using Shoko.Server.Scheduling.Acquisition;

namespace Shoko.Server.Scheduling.Jobs.Actions;

[DatabaseRequired]
[JobKeyMember("RemoveMissingFiles")]
[JobKeyGroup("Legacy")]
[JobKeyGroup(JobKeyGroup.Legacy)]
[DisallowConcurrentExecution]
internal class RemoveMissingFilesJob : IJob
{
Expand Down
4 changes: 3 additions & 1 deletion Shoko.Server/Scheduling/Jobs/Actions/ScanDropFoldersJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
using System.Threading.Tasks;
using Quartz;
using QuartzJobFactory.Attributes;
using Shoko.Server.Scheduling.Acquisition;

namespace Shoko.Server.Scheduling.Jobs.Actions;

[DatabaseRequired]
[JobKeyMember("ScanDropFolders")]
[JobKeyGroup("Legacy")]
[JobKeyGroup(JobKeyGroup.Legacy)]
internal class ScanDropFoldersJob : IJob
{
public Task Execute(IJobExecutionContext context)
Expand Down
5 changes: 4 additions & 1 deletion Shoko.Server/Scheduling/Jobs/AniDB/AniDBGetFileJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Quartz;
using QuartzJobFactory.Attributes;
using Shoko.Commons.Queue;
using Shoko.Models.Enums;
using Shoko.Models.Queue;
Expand All @@ -16,12 +16,15 @@
using Shoko.Server.Providers.AniDB.UDP.Generic;
using Shoko.Server.Providers.AniDB.UDP.Info;
using Shoko.Server.Repositories;
using Shoko.Server.Scheduling.Acquisition;
using Shoko.Server.Scheduling.Concurrency;
using Shoko.Server.Server;

namespace Shoko.Server.Scheduling.Jobs.AniDB;

[DatabaseRequired, NetworkRequired, AniDBUDPRateLimited]
[DisallowConcurrencyGroup(ConcurrencyGroups.AniDB_UDP)]
[JobKeyGroup(JobKeyGroup.AniDB)]
[Command(CommandRequestType.AniDB_GetFileUDP)]
public class AniDBGetFileJob : BaseJob
{
Expand Down
10 changes: 10 additions & 0 deletions Shoko.Server/Scheduling/Jobs/JobKeyGroup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Shoko.Server.Scheduling.Jobs;

public static class JobKeyGroup
{
public const string Import = "Import";
public const string AniDB = "AniDB";
public const string Legacy = "Legacy";
public const string System = "System";
public const string Actions = "Actions";
}
4 changes: 3 additions & 1 deletion Shoko.Server/Scheduling/Jobs/Shoko/DeleteImportFolderJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
using System.Threading.Tasks;
using Quartz;
using QuartzJobFactory.Attributes;
using Shoko.Server.Scheduling.Acquisition;

namespace Shoko.Server.Scheduling.Jobs.Shoko;

[DatabaseRequired]
[JobKeyMember("DeleteImportFolder")]
[JobKeyGroup("Actions")]
[JobKeyGroup(JobKeyGroup.Actions)]
internal class DeleteImportFolderJob : IJob
{
public int ImportFolderID { get; set; }
Expand Down
4 changes: 4 additions & 0 deletions Shoko.Server/Scheduling/Jobs/Shoko/DiscoverFileJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@
using Microsoft.Extensions.Logging;
using Quartz;
using QuartzJobFactory;
using QuartzJobFactory.Attributes;
using Shoko.Commons.Queue;
using Shoko.Models.Queue;
using Shoko.Server.Databases;
using Shoko.Server.Models;
using Shoko.Server.Repositories;
using Shoko.Server.Repositories.Cached;
using Shoko.Server.Scheduling.Acquisition;
using Shoko.Server.Server;
using Shoko.Server.Settings;

namespace Shoko.Server.Scheduling.Jobs.Shoko;

[DatabaseRequired]
[JobKeyGroup(JobKeyGroup.Import)]
public class DiscoverFileJob : BaseJob
{
public virtual string FileName { get; set; }
Expand Down
4 changes: 4 additions & 0 deletions Shoko.Server/Scheduling/Jobs/Shoko/HashFileJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Quartz;
using QuartzJobFactory.Attributes;
using Shoko.Commons.Queue;
using Shoko.Models.Queue;
using Shoko.Models.Server;
Expand All @@ -15,14 +16,17 @@
using Shoko.Server.Models;
using Shoko.Server.Repositories;
using Shoko.Server.Repositories.Cached;
using Shoko.Server.Scheduling.Acquisition;
using Shoko.Server.Scheduling.Concurrency;
using Shoko.Server.Server;
using Shoko.Server.Settings;
using Shoko.Server.Utilities;

namespace Shoko.Server.Scheduling.Jobs.Shoko;

[DatabaseRequired]
[LimitConcurrency]
[JobKeyGroup(JobKeyGroup.Import)]
public class HashFileJob : BaseJob
{
public virtual string FileName { get; set; }
Expand Down
4 changes: 3 additions & 1 deletion Shoko.Server/Scheduling/Jobs/Shoko/ScanFolderJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
using System.Threading.Tasks;
using Quartz;
using QuartzJobFactory.Attributes;
using Shoko.Server.Scheduling.Acquisition;

namespace Shoko.Server.Scheduling.Jobs.Shoko;

[DatabaseRequired]
[JobKeyMember("ScanFolder")]
[JobKeyGroup("Actions")]
[JobKeyGroup(JobKeyGroup.Actions)]
internal class ScanFolderJob : IJob
{
[JobKeyMember]
Expand Down

0 comments on commit 4003bd3

Please sign in to comment.