jenkinsci / bitbucket-branch-source-plugin

Bitbucket Branch Source Plugin
https://plugins.jenkins.io/cloudbees-bitbucket-branch-source
MIT License
216 stars 353 forks source link

Introduce exponential backoff strategy for BitbucketCloudApiClient for rate-limiting #840

Open thomas-boehm-tractive opened 6 months ago

thomas-boehm-tractive commented 6 months ago

What feature do you want to see added?

The BitbucketCloudApiClient currently uses a fixed wait time of 5 seconds if rate-limited. As bitbucket rate-limit is hourly based, permanently waiting for 5 seconds doesn't seem to be very useful. Especially if multiple requests are already rate-limited, the number of requests seems to be increasing unecessarily.

Therefore, I would propose to change the backoff strategy to an exponential one, in order to avoid lots of requests.

BitbucketServerApiClient seems to be already using an exponential backoff in the retry strategy.

Upstream changes

No response

Are you interested in contributing this feature?

yes, I already have solution on one of my local branches and will open a PR for further discussion in a few minutes