Replicating Retry Strategy: Specific Errors, Delay, and Maximum Attempts
I'm trying to replicate an existing retry strategy that looks like:
* only retry if the error matches specific error/s (otherwise fail)
* begin with a delay of
* double the delay each retry attempt up to a max of
* retry a maximum of 5 times
I wasn't able to figure it out by looking at the docs, but I did find Composing Retry Methods retryN retryWhile with part of what I think I need.
So, now what I have is:
Struggling with the
* only retry if the error matches specific error/s (otherwise fail)
* begin with a delay of
startDelay ms between retries* double the delay each retry attempt up to a max of
maxDelay ms* retry a maximum of 5 times
I wasn't able to figure it out by looking at the docs, but I did find Composing Retry Methods retryN retryWhile with part of what I think I need.
So, now what I have is:
Struggling with the
Schedule.linear part. I think Schedule.linear is correct, but I'm not sure how to properly prevent it from going above maxDelay. The above code seems to just make it delay 500 ms between each retry. 