private ITaskSeriesTimer CreateLeaseRenewalTimer(TimeSpan leasePeriod, IDistributedLock lockHandle) { // 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(this._lockManager, lockHandle, speedupStrategy); return(new TaskSeriesTimer(command, this._exceptionHandler, Task.Delay(normalUpdateInterval))); }
private ITaskSeriesTimer CreateLeaseRenewalTimer(IStorageBlockBlob leaseBlob, string leaseId, string lockId, TimeSpan leasePeriod, IWebJobsExceptionHandler exceptionHandler) { // 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, exceptionHandler, Task.Delay(normalUpdateInterval))); }
private static ITaskSeriesTimer CreateLeaseRenewalTimer(TimeSpan leasePeriod, IDistributedLockManager distributedLockManager, IDistributedLock lockHandle, Func <bool> preExecuteCheck) { // renew the lease when it is halfway to expiring var normalUpdateInterval = new TimeSpan(leasePeriod.Ticks / 2); IDelayStrategy speedupStrategy = new LinearSpeedupStrategy(normalUpdateInterval, TimeSpan.FromMilliseconds(250)); ITaskSeriesCommand command = new RenewLeaseCommand(distributedLockManager, lockHandle, speedupStrategy); return(new TaskSeriesTimer(command, Task.Delay(normalUpdateInterval), preExecuteCheck)); }
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)); }