-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: wire up secondary service, with separate schedule
Ensure they share the same overlap identifier, so they are staggered.
- Loading branch information
1 parent
6402511
commit dceb6cb
Showing
10 changed files
with
69 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 8 additions & 3 deletions
11
...ilean.ApiService/Features/Sync/SyncJob.cs → ...an.ApiService/Features/Sync/DmmSyncJob.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace Zilean.ApiService.Features.Sync; | ||
|
||
public class GenericSyncJob(IShellExecutionService shellExecutionService, ILogger<GenericSyncJob> logger, ZileanDbContext dbContext) : IInvocable, ICancellableInvocable | ||
{ | ||
public CancellationToken CancellationToken { get; set; } | ||
private const string GenericSyncArg = "generic-sync"; | ||
|
||
public async Task Invoke() | ||
{ | ||
logger.LogInformation("Generic SyncJob started"); | ||
|
||
var argumentBuilder = ArgumentsBuilder.Create(); | ||
argumentBuilder.AppendArgument(GenericSyncArg, string.Empty, false, false); | ||
|
||
await shellExecutionService.ExecuteCommand(new ShellCommandOptions | ||
{ | ||
Command = Path.Combine(AppContext.BaseDirectory, "scraper"), | ||
ArgumentsBuilder = argumentBuilder, | ||
ShowOutput = true, | ||
CancellationToken = CancellationToken | ||
}); | ||
|
||
logger.LogInformation("Generic SyncJob completed"); | ||
} | ||
|
||
// ReSharper disable once MethodSupportsCancellation | ||
public Task<bool> ShouldRunOnStartup() => dbContext.ParsedPages.AnyAsync(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters