Fix Timer ExecuteAt persistence (for Trigger)

Without ExecuteAt receiving a value (even if it lies in the past), the TimerTriggerProvider will keep triggering workflows containing a Timer.
This commit is contained in:
Sipke Schoorstra 2020-12-24 21:36:42 +01:00
parent 28ac92b6ff
commit 8a4fae6f38

View file

@ -32,11 +32,12 @@ namespace Elsa.Activities.Timers
if (context.WorkflowExecutionContext.IsFirstPass)
return Done();
if (Timeout <= Duration.Zero)
var now = _clock.GetCurrentInstant();
ExecuteAt = now.Plus(Timeout);
if (ExecuteAt <= now)
return Done();
ExecuteAt = _clock.GetCurrentInstant().Plus(Timeout);
return Combine(Suspend(), new ScheduleWorkflowResult(ExecuteAt.Value));
}