public override IEnumerable <WorkflowDecision> ScheduleDecisionsByIgnoringWhen() { if (this == RescheduleTimer) { return new[] { ScheduleTimerDecision.RescheduleTimer(ScheduleId, _fireAfterFunc(this)) } } ; return(new[] { ScheduleTimerDecision.WorkflowItem(ScheduleId, _fireAfterFunc(this)) }); }
private WorkflowAction ResetAction(TimeSpan?timeout = null) { if (!IsActive) { throw new InvalidOperationException( $"Can not reset the timer {this}. It should be already active for it be reset."); } var lastTimerEvent = (TimerEvent)LastEvent(true); var rescheduleId = RescheduleId(lastTimerEvent.Id); return(WorkflowAction.Custom(new CancelTimerDecision(lastTimerEvent.Id), ScheduleTimerDecision.WorkflowItem(rescheduleId, timeout ?? lastTimerEvent.Timeout))); }
private WorkflowDecision WaitForSignalTimerDecision(IWorkflowHistoryEvents historyEvents) { if (_timerWait == null) { return(WorkflowDecision.Empty); } var delay = historyEvents.ServerTimeUtc - _waitingEventTimeStamp; if (delay > _timerWait.Value) { return(ScheduleTimerDecision.SignalTimer(_scheduleId, _data.TriggerEventId, TimeSpan.Zero)); } var timeout = _timerWait.Value - delay; return(ScheduleTimerDecision.SignalTimer(_scheduleId, _data.TriggerEventId, timeout)); }
private bool Equals(ScheduleTimerDecision other) { return(_id.Equals(other._id)); }