-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix scheduling, add a way to manually refresh a torrent, rework Compo…
…siteService, improve endpoint responses further
- Loading branch information
Showing
15 changed files
with
197 additions
and
77 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
13 changes: 13 additions & 0 deletions
13
src/TransmissionManager.Api/Composite/Dto/AddOrUpdateTorrentResult.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using static TransmissionManager.Api.Composite.Dto.AddOrUpdateTorrentResult; | ||
|
||
namespace TransmissionManager.Api.Composite.Dto; | ||
|
||
public readonly record struct AddOrUpdateTorrentResult(ResultType Type, long Id, string? ErrorMessage) | ||
{ | ||
public enum ResultType | ||
{ | ||
Add, | ||
Update, | ||
Error | ||
} | ||
} |
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
23 changes: 23 additions & 0 deletions
23
src/TransmissionManager.Api/Scheduling/Services/TorrentRefreshTask.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Coravel.Invocable; | ||
using TransmissionManager.Api.Composite.Services; | ||
using TransmissionManager.Api.Database.Services; | ||
|
||
namespace TransmissionManager.Api.Scheduling.Services; | ||
|
||
public sealed class TorrentRefreshTask( | ||
ILogger<TorrentRefreshTask> logger, | ||
CompositeService<TorrentService> compositeService, | ||
long torrentId) | ||
: IInvocable, ICancellableInvocable | ||
{ | ||
public CancellationToken CancellationToken { get; set; } | ||
|
||
public async Task Invoke() | ||
{ | ||
var error = await compositeService.RefreshTorrentAsync(torrentId, CancellationToken); | ||
if (!string.IsNullOrEmpty(error)) | ||
{ | ||
logger.LogError("Could not refresh the torrent with id '{id}' on schedule: '{error}'.", torrentId, error); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.