コード例 #1
0
        protected NowOrNever Delay(TimeSpan delay)
        {
            var date       = GetDateTimeUtcNow();
            var scheduleAt = date + delay;

            ScheduledAt existingDelay;

            if (TryPop(out existingDelay))
            {
                if (existingDelay.Value > _context.DateTimeUtcNow())
                {
                    EndCurrentExecution();
                    return(NowOrNever.Never);
                }

                return(NowOrNever.Now);
            }

            if (scheduleAt <= date)
            {
                return(NowOrNever.Now);
            }

            Append(new ScheduledAt(scheduleAt));
            EndCurrentExecution();
            return(NowOrNever.Never);
        }
コード例 #2
0
 static void BurnUnneededValues(IEnumerable <IEvent> initialEvents, IOrchestrationContext context)
 {
     foreach (var @event in initialEvents)
     {
         if (@event is GuidGenerated)
         {
             context.NewGuid();
         }
         if (@event is DateTimeRetrieved)
         {
             context.DateTimeUtcNow();
         }
     }
 }