public static ITaskSeriesTimer CreateTimer(IRecurrentCommand command, TimeSpan normalInterval, TimeSpan minimumInterval, IBackgroundExceptionDispatcher backgroundExceptionDispatcher) { IDelayStrategy delayStrategy = new LinearSpeedupStrategy(normalInterval, minimumInterval); ITaskSeriesCommand timerCommand = new RecurrentTaskSeriesCommand(command, delayStrategy); return new TaskSeriesTimer(timerCommand, backgroundExceptionDispatcher, Task.Delay(normalInterval)); }
public static ITaskSeriesTimer CreateTimer(IRecurrentCommand command, TimeSpan normalInterval, TimeSpan minimumInterval, IBackgroundExceptionDispatcher backgroundExceptionDispatcher) { IDelayStrategy delayStrategy = new LinearSpeedupStrategy(normalInterval, minimumInterval); ITaskSeriesCommand timerCommand = new RecurrentTaskSeriesCommand(command, delayStrategy); return(new TaskSeriesTimer(timerCommand, backgroundExceptionDispatcher, Task.Delay(normalInterval))); }
public static ITaskSeriesTimer CreateTimer(IRecurrentCommand command, TimeSpan normalInterval, TimeSpan minimumInterval, IWebJobsExceptionHandler exceptionHandler) { IDelayStrategy delayStrategy = new LinearSpeedupStrategy(normalInterval, minimumInterval); ITaskSeriesCommand timerCommand = new RecurrentTaskSeriesCommand(command, delayStrategy); return(new TaskSeriesTimer(timerCommand, exceptionHandler, Task.Delay(normalInterval))); }
private ITaskSeriesTimer CreateLeaseRenewalTimer(IStorageBlockBlob leaseBlob, string leaseId, string lockId, TimeSpan leasePeriod, IBackgroundExceptionDispatcher backgroundExceptionDispatcher) { // renew the lease when it is halfway to expiring TimeSpan normalUpdateInterval = new TimeSpan(leasePeriod.Ticks / 2); IDelayStrategy speedupStrategy = new LinearSpeedupStrategy(normalUpdateInterval, MinimumLeaseRenewalInterval); ITaskSeriesCommand command = new RenewLeaseCommand(leaseBlob, leaseId, lockId, speedupStrategy, _trace); return new TaskSeriesTimer(command, backgroundExceptionDispatcher, Task.Delay(normalUpdateInterval)); }
private static ITaskSeriesTimer CreateUpdateMessageVisibilityTimer(IStorageQueue queue, IStorageQueueMessage message, TimeSpan visibilityTimeout, IBackgroundExceptionDispatcher backgroundExceptionDispatcher) { // Update a message's visibility when it is halfway to expiring. TimeSpan normalUpdateInterval = new TimeSpan(visibilityTimeout.Ticks / 2); IDelayStrategy speedupStrategy = new LinearSpeedupStrategy(normalUpdateInterval, TimeSpan.FromMinutes(1)); ITaskSeriesCommand command = new UpdateQueueMessageVisibilityCommand(queue, message, visibilityTimeout, speedupStrategy); return new TaskSeriesTimer(command, backgroundExceptionDispatcher, Task.Delay(normalUpdateInterval)); }