Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix backoff logic in ResilientStream #906

Merged
merged 1 commit into from
Jan 18, 2024

Conversation

poohsen
Copy link
Contributor

@poohsen poohsen commented Dec 7, 2023

The backoff is now truly exponential (Math.pow(count, 2)) because the sleep is done before the next recursive call to loop instead of inside it.
This way the message "Restarting in x seconds" actually becomes true. Previously the backoff was somewhat similar to a Fibonacci sequence because the restarted program contained the previous iteration's sleep time plus the current one.

Also removes the ??? in favor of logging the Exception messages and rethrowing for improved observability. (the logging backend gets a chance to e.g. format the log for proper ingestion into services such as DataDog)

The backoff is now truly exponential (Math.pow(count, 2)) because the sleep is done before the next recursive call to loop instead of inside it.
This way the message "Restarting in x seconds" actually becomes true. Previously the backoff was somewhat similar to a Fibonacci sequence because the restarted program contained the previous iteration's sleep time plus the current one.

Also removes the ??? in favor of logging the Exception messages and rethrowing for improved observability. (the logging backend gets a chance to e.g. format the log for proper ingestion into services such as DataDog)
@matejcerny matejcerny merged commit b0091c4 into profunktor:master Jan 18, 2024
1 check passed
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.

2 participants