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); }
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(); } } }