Xuanwo/backon

the longest back off will be wasted

Xuanwo opened this issue · 0 comments

Sorry for forgetting to break after a success request.

We are using ExponentialBackOff directly so things get different with just using a backon::retry() method or backon::Retry structure.

When the iteration just restarts from the longest back off, the next item in iterator will be None, then the for loop will be quited and the longest back off will be wasted.

To avoid this, to retry the same request after the longest back off, a zero duration sleep will be added. If the very last request failed, sleep(0).await cost little, the loop will reach the end and the error will be returned in time.

Originally posted by @ClSlaid in datafuselabs/databend#7809 (comment)