-
Notifications
You must be signed in to change notification settings - Fork 353
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
Change backoff strategy to exponential for BitbucketCloudApiClient when rate-limited #841
base: master
Are you sure you want to change the base?
Change backoff strategy to exponential for BitbucketCloudApiClient when rate-limited #841
Conversation
src/main/java/com/cloudbees/jenkins/plugins/bitbucket/client/BitbucketCloudApiClient.java
Outdated
Show resolved
Hide resolved
LOGGER.log(Level.FINE, "Bitbucket Cloud API rate limit reached for {0}, sleeping for {1} sec then retry...", new Object[]{httpMethod.getURI(), sleepTime}); | ||
Thread.sleep(sleepTime); | ||
retryCount++; | ||
LOGGER.log(Level.FINE, "Retrying Bitbucket Cloud API request for {0}, retryCount={1}", new Object[]{httpMethod.getURI(), retryCount}); | ||
response = client.execute(host, httpMethod, requestContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this close the previous CloseableHttpResponse response
? If so, that isn't a new bug though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is a different issue that is not really related to my changes, I guess it makes more sense to move this to a separate ticket and PR, if this causes issues. I think it doesn't really belong to this one.
src/main/java/com/cloudbees/jenkins/plugins/bitbucket/client/BitbucketCloudApiClient.java
Outdated
Show resolved
Hide resolved
094dd6d
to
463cef9
Compare
463cef9
to
5f3a712
Compare
This PR is already covered by the #414 that have a long discussion. |
5f3a712
to
29811dc
Compare
@nfalco79 does that mean I sould close this PR? |
PRs should refer to an issue with the reason of changes, in this cases there is one with details. For what I see other PR has an ongoing review with the old-old maintainers but was stucks. What I mean is that this PR should takes in consideration those changes, comments and the JIRA issue to completed. |
29811dc
to
c1680c1
Compare
… to not overwhelm the bitbucket API
c1680c1
to
a213bac
Compare
The rate limit impact both server and cloud instances.
I found this implementation org.apache.http.impl.client.cache.ExponentialBackOffSchedulingStrategy maybe combined with org.apache.http.client.HttpRequestRetryHandler |
Change backoff strategy to exponential for BitbucketCloudApiClient when rate-limited, as a fixed wait time of 5 seconds sends too many unnecessary requests that can be avoided.
Your checklist for this pull request
Fixes #840