コード例 #1
0
ファイル: TimerItem.cs プロジェクト: gurmitteotia/guflow
        public override IEnumerable <WorkflowDecision> ScheduleDecisionsByIgnoringWhen()
        {
            if (this == RescheduleTimer)
            {
                return new[] { ScheduleTimerDecision.RescheduleTimer(ScheduleId, _fireAfterFunc(this)) }
            }
            ;

            return(new[] { ScheduleTimerDecision.WorkflowItem(ScheduleId, _fireAfterFunc(this)) });
        }
コード例 #2
0
ファイル: TimerItem.cs プロジェクト: gurmitteotia/guflow
        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));
 }