Unique IDs for TrangaTask now based on Random-generator
This commit is contained in:
parent
b2b4256972
commit
821a1b7c3a
@ -42,7 +42,7 @@ public abstract class TrangaTask
|
|||||||
this.task = task;
|
this.task = task;
|
||||||
this.executionStarted = DateTime.Now;
|
this.executionStarted = DateTime.Now;
|
||||||
this.lastChange = DateTime.MaxValue;
|
this.lastChange = DateTime.MaxValue;
|
||||||
this.taskId = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(this.executionStarted.ToString(CultureInfo.InvariantCulture)));
|
this.taskId = Convert.ToBase64String(BitConverter.GetBytes(new Random().Next()));
|
||||||
this.childTasks = new();
|
this.childTasks = new();
|
||||||
this.parentTask = parentTask;
|
this.parentTask = parentTask;
|
||||||
this.parentTaskId = parentTask?.taskId;
|
this.parentTaskId = parentTask?.taskId;
|
||||||
@ -69,6 +69,8 @@ public abstract class TrangaTask
|
|||||||
this.executionStarted = DateTime.Now;
|
this.executionStarted = DateTime.Now;
|
||||||
this.lastChange = DateTime.Now;
|
this.lastChange = DateTime.Now;
|
||||||
ExecuteTask(taskManager, logger, cancellationToken);
|
ExecuteTask(taskManager, logger, cancellationToken);
|
||||||
|
while(this.childTasks.Any(childTask => childTask.state is ExecutionState.Running or ExecutionState.Enqueued))
|
||||||
|
Thread.Sleep(1000);
|
||||||
this.lastExecuted = DateTime.Now;
|
this.lastExecuted = DateTime.Now;
|
||||||
this.state = ExecutionState.Waiting;
|
this.state = ExecutionState.Waiting;
|
||||||
logger?.WriteLine(this.GetType().ToString(), $"Finished Executing Task {this}");
|
logger?.WriteLine(this.GetType().ToString(), $"Finished Executing Task {this}");
|
||||||
|
Loading…
Reference in New Issue
Block a user