RetryPolicy::ExecuteAsync() should terminate when waiting for next retry and CancellationToken is set


Current behavior when the RetryPolicy is waiting for next retry and the CancellationToken is set is to delay until it is time to run the next retry and then throw the previous exception. The desired behavior is to break the delay and immediately throw the previous exception. This can be done by changing AsyncExecution::ExecuteAsyncContinueWith() and replacing:

return Task.Delay(delay)


return Task.Delay(delay, this.cancellationToken)


ghelyar wrote Jan 12, 2016 at 11:55 AM

This would be very useful.

If there is a delay of e.g. 30 seconds and it is cancelled, it should not wait for the delay to complete before checking the token.

mekoda wrote Jan 21, 2016 at 12:46 PM

Hi, it's already solved in 244ad9d3face.