Skip to content

Make the first exp of retry with backoff be 0#29

Open
lahiguera wants to merge 1 commit intoslok:masterfrom
lahiguera:retry_exponent
Open

Make the first exp of retry with backoff be 0#29
lahiguera wants to merge 1 commit intoslok:masterfrom
lahiguera:retry_exponent

Conversation

@lahiguera
Copy link

Context:

Previously the first exponent used to calculate the first waiting
time when retrying using the expoential backoff algorithm with
full jitter was 1, i.e. 2**1 was used instead of 2**0. This made
the first waiting time longer (only potentially because of jitter)
than what it's supposed to be.

Also previously the tests in retry_test.go that relied on
patternTimer were not actually testing anything, since the Run
method of such struct prevented the recording of the waiting times
because prevExecution was always equal to time.Time{}.

This PR fixes the issues mentioned above.

Context:
--------

Previously the first exponent used to calculate the first waiting
time when retrying using the expoential backoff algorithm with
full jitter was 1, i.e. 2**1 was used instead of 2**0. This made
the first waiting time longer (only potentially because of jitter)
than what it's supposed to be.

Also previously the tests in `retry_test.go` that relied on
`patternTimer` were not actually testing anything, since the `Run`
method of such struct preventing the recording of the waiting times
because `prevExecution` was always equal to time.Time{}.

This PR fixes the issues mentioned above.
@lahiguera lahiguera requested a review from slok as a code owner October 20, 2020 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant