mirror of
https://github.com/C9Glax/tranga.git
synced 2025-09-10 20:08:19 +02:00
Compare commits
1 Commits
bubez81/mw
...
7f9bea00a4
Author | SHA1 | Date | |
---|---|---|---|
7f9bea00a4 |
@@ -324,7 +324,7 @@ public class MangaDex : MangaConnector
|
|||||||
{
|
{
|
||||||
string? id = jToken.Value<string>("id");
|
string? id = jToken.Value<string>("id");
|
||||||
JToken? attributes = jToken["attributes"];
|
JToken? attributes = jToken["attributes"];
|
||||||
string? chapterStr = attributes?.Value<string>("chapter");
|
string? chapterStr = attributes?.Value<string>("chapter") ?? "0";
|
||||||
string? volumeStr = attributes?.Value<string>("volume");
|
string? volumeStr = attributes?.Value<string>("volume");
|
||||||
int? volumeNumber = null;
|
int? volumeNumber = null;
|
||||||
string? title = attributes?.Value<string>("title");
|
string? title = attributes?.Value<string>("title");
|
||||||
|
@@ -73,24 +73,23 @@ public abstract class BaseWorker : Identifiable
|
|||||||
{
|
{
|
||||||
// Start the worker
|
// Start the worker
|
||||||
Log.Debug($"Checking {this}");
|
Log.Debug($"Checking {this}");
|
||||||
this._cancellationTokenSource = new(TimeSpan.FromMinutes(10));
|
_cancellationTokenSource = new(TimeSpan.FromMinutes(10));
|
||||||
this.State = WorkerExecutionState.Waiting;
|
State = WorkerExecutionState.Waiting;
|
||||||
|
|
||||||
// Wait for dependencies, start them if necessary
|
// Wait for dependencies, start them if necessary
|
||||||
BaseWorker[] missingDependenciesThatNeedStarting = MissingDependencies.Where(d => d.State < WorkerExecutionState.Waiting).ToArray();
|
BaseWorker[] missingDependenciesThatNeedStarting = MissingDependencies.Where(d => d.State < WorkerExecutionState.Waiting).ToArray();
|
||||||
if(missingDependenciesThatNeedStarting.Any())
|
if(missingDependenciesThatNeedStarting.Any())
|
||||||
return new Task<BaseWorker[]>(() => missingDependenciesThatNeedStarting);
|
return new (() => missingDependenciesThatNeedStarting);
|
||||||
|
|
||||||
if (MissingDependencies.Any())
|
if (MissingDependencies.Any())
|
||||||
return new Task<BaseWorker[]>(WaitForDependencies);
|
return new (WaitForDependencies);
|
||||||
|
|
||||||
// Run the actual work
|
// Run the actual work
|
||||||
Log.Info($"Running {this}");
|
Log.Info($"Running {this}");
|
||||||
DateTime startTime = DateTime.UtcNow;
|
DateTime startTime = DateTime.UtcNow;
|
||||||
Task<BaseWorker[]> task = new Task<BaseWorker[]>(() => DoWorkInternal().Result);
|
State = WorkerExecutionState.Running;
|
||||||
|
Task<BaseWorker[]> task = DoWorkInternal();
|
||||||
task.GetAwaiter().OnCompleted(Finish(startTime, callback));
|
task.GetAwaiter().OnCompleted(Finish(startTime, callback));
|
||||||
this.State = WorkerExecutionState.Running;
|
|
||||||
task.Start();
|
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user