riesgos / async

0 stars 0 forks source link

HTTP retry: No need to sleep after last attempt #69

Closed MichaelLangbein closed 1 year ago

MichaelLangbein commented 1 year ago

asyncwrapper/src/main/kotlin/org/n/riesgos/asyncwrapper/utils/RetryUtils.kt

            // ignore this specific exception and retry
            retryCount++
            lastException = ex
            Thread.sleep(sleepTimeMilliSeconds)

I realized that we also sleep if we failed on the last attempt - one of the errors I made when I wrote the first version of this retry decorator.

Maybe we can a simple if statement here, so that we don't sleep when we already know that there will be no last attempt.

arnevogt commented 1 year ago

fixed in #59