Skip to content

How to migrate to v8 when using wait and retry with enumerable sleep durations #1717

Answered by peter-csala
gitfool asked this question in Q&A
Discussion options

You must be logged in to vote

For any arbitrary EnumerateDelay you can do the following:

var delaysEnumerator = EnumerateDelay().GetEnumerator();
ResiliencePipeline = new ...
{
   DelayGenerator = args => ValueTask.FromResult<TimeSpan?>(delaysEnumerator.MoveNext() ? delaysEnumerator.Current : null),
   ...
}).Build();

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@gitfool
Comment options

@martintmk
Comment options

Comment options

You must be logged in to vote
1 reply
@gitfool
Comment options

Answer selected by gitfool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants