jenkinsci / bitbucket-branch-source-plugin

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

Do not endlessly retry rate limited requests to bitbucket cloud #831

Open tsalzinger opened 3 months ago

tsalzinger commented 3 months ago

Currently BitbucketCloudApiClient retries all requests which have been rate limited endlessly (as long as every single try again results in a rate limit response). This is troublesome for a few reasons (and I'm sure there are more):

In comparison BitbucketServerAPIClient actually stops after a max duration (currently 30 minutes) of total wait time has accumulated.

Note: Additionally, when the request happens to be one that should be cached, this potentially leads to a a deadlock to the usage of a synchronized method in the Cache - this is a separate issue though and should not be tackled as part of this issue.

Related resources for API request limits of bitbucket cloud:

Are you interested in contributing this feature?

yes, the overall implementation wouldn't be that difficult, the main issue is to agree on a proper approach. A max duration would already have been introduced as well with #414 but there was a comment that it should be kept as is, without any further rational (and the PR seems to be abandoned at this point anyway).

In general I see a few different approaches that might be viable (order does not reflect my preference):