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

feat: add jitter for retries #41

Merged
merged 4 commits into from
Sep 27, 2024
Merged

feat: add jitter for retries #41

merged 4 commits into from
Sep 27, 2024

Conversation

knqyf263
Copy link
Collaborator

Description

Currently, if an HTTP request fails, all requests are retried after waiting for the same period of time. This can cause further 429 errors as many requests are issued at the same time again. To mitigate this, this PR introduces a random wait time (jitter).

024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/com/amazonaws/aws-java-sdk-workmailmessageflow/1.11.724/ num_tries=11 status_code=429
2024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.asm-2.2.3/1.0.0-rc1/ num_tries=11 status_code=429
2024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/io/quarkus/quarkus-jdbc-h2-parent/1.4.1.Final/ num_tries=11 status_code=429
2024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/org/apache/spark/spark-launcher_2.11/1.6.2/ num_tries=11 status_code=429
2024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/dev/reformator/stacktracedecoroutinator/ num_tries=11 status_code=429
2024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/aws/sdk/kotlin/m2-jvm/1.2.1/ num_tries=11 status_code=429
2024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/org/cdk8s/cdk8s/1.10.107/ num_tries=11 status_code=429
2024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/com/amazonaws/aws-java-sdk-networkmanager/1.12.570/ num_tries=11 status_code=429
2024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/com/amazonaws/aws-java-sdk-sns/1.11.267/ num_tries=11 status_code=429
2024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/software/amazon/awssdk/organizations/2.21.26/ num_tries=11 status_code=429
2024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/software/amazon/awssdk/savingsplans/2.17.182/ num_tries=11 status_code=429
2024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/org/apache/struts/struts2-gxp-plugin/2.5.10.1/ num_tries=11 status_code=429
2024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/org/apache/geronimo/gshell/support/gshell-support/ num_tries=11 status_code=429
2024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/software/amazon/awssdk/wellarchitected/2.16.46/ num_tries=11 status_code=429
2024/09/26 06:35:32 ERROR HTTP error url=https://repo.maven.apache.org/maven2/org/apache/shardingsphere/elasticjob/elasticjob-lite-lifecycle/3.0.4/ num_tries=11 status_code=429

Rationale

Since LinearJitterBackoff doesn't respect Retry-After, we don't need to delete the header anymore.

Signed-off-by: knqyf263 <[email protected]>
@knqyf263
Copy link
Collaborator Author

@knqyf263 knqyf263 marked this pull request as ready for review September 26, 2024 19:10
Copy link
Collaborator

@DmitriyLewen DmitriyLewen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@knqyf263 knqyf263 merged commit 577c6a3 into main Sep 27, 2024
4 checks passed
@knqyf263 knqyf263 deleted the add_jitter branch September 27, 2024 06: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.

2 participants