Skip to content

Commit

Permalink
Fixed type not found error.
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Jan 1, 2024
1 parent 36426c5 commit a6590f2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions NeuroSpeech.Eternity/EternityContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,6 @@ private async Task RunWorkflowAsync(EternityEntity entity, CancellationToken arg
using var session = this.logger.BeginLogSession();
try
{
var originalType = Type.GetType(entity.Name);
var workflowType = this.GetDerived(originalType);
// we need to begin...
var instance = GetWorkflowInstance(entity, originalType, workflowType, entity.ID, entity.UtcCreated);

if (entity.State == EternityEntityState.Completed
|| entity.State == EternityEntityState.Failed)
{
Expand All @@ -277,8 +272,13 @@ private async Task RunWorkflowAsync(EternityEntity entity, CancellationToken arg
return;
}

IWorkflow? instance = null;

try
{
var originalType = Type.GetType(entity.Name);
var workflowType = this.GetDerived(originalType);
instance = GetWorkflowInstance(entity, originalType, workflowType, entity.ID, entity.UtcCreated);
var input = JsonSerializer.Deserialize(entity.Input ?? "null", instance.InputType, options);
var result = await instance.RunAsync(input!);
var now = clock.UtcNow;
Expand All @@ -302,9 +302,9 @@ private async Task RunWorkflowAsync(EternityEntity entity, CancellationToken arg
entity.State = EternityEntityState.Failed;
var now = clock.UtcNow;
entity.UtcUpdated = now;
entity.UtcETA = now.Add(instance.PreserveTime);
entity.UtcETA = now.Add(instance?.FailurePreserveTime ?? TimeSpan.FromHours(24));
entity.Priority = -1;
session?.LogError($"Workflow {entity.ID} failed. {ex.ToString()}");
session?.LogError($"Workflow {entity.ID} failed. {ex}");
}
if (entity.ParentID != null)
{
Expand Down

0 comments on commit a6590f2

Please sign in to comment.