Beispiel #1
0
        public override IEnumerable <WorkflowDecision> ScheduleDecisionsByIgnoringWhen()
        {
            if (this == RescheduleTimer)
            {
                return new[] { ScheduleTimerDecision.RescheduleTimer(ScheduleId, _fireAfterFunc(this)) }
            }
            ;

            return(new[] { ScheduleTimerDecision.WorkflowItem(ScheduleId, _fireAfterFunc(this)) });
        }
Beispiel #2
0
        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)));
        }