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

            return(new[] { ScheduleTimerDecision.WorkflowItem(ScheduleId, _fireAfterFunc(this)) });
        }
Пример #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)));
        }
Пример #3
0
        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));
        }
Пример #4
0
 private bool Equals(ScheduleTimerDecision other)
 {
     return(_id.Equals(other._id));
 }