-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Support pagination to fetch _all_ Bitbucket branches #18563
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
Conversation
FYI, reviewing while ignoring whitespace changes is much easier here: |
Thanks, @jankeromnes for raising a fix ! 🙏 - I'm happy for this to be reviewed + tested, however I would suggest we hold off a little longer on the merge + release (internal context). |
Thanks @loujaybee! 🙌
Sorry if I'm missing something, but what is the benefit of leaving a feature broken for a longer time? (I.e. what is the downside of fixing this small bug as soon as possible?) To me, the slightly broken feature and the larger customer UX discovery are two completely separate topics. |
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.
Code changes LGTM. Did not test because preview environment does not seem to have been triggered 👀
components/server/src/bitbucket/bitbucket-repository-provider.ts
Outdated
Show resolved
Hide resolved
Many thanks @filiptronicek for the review! And for pointing out that there is no preview env. I've attempted to get GitHub Actions to produce one. Let's see if it does. 👀 |
Whoa, many thanks for testing @filiptronicek! 🎉 (2 minutes 🤯) |
f818630
to
75b87d5
Compare
I've removed the unnecessary type annotations and added a |
@filiptronicek Could you please briefly test with your fork again? 😇 🙏 I believe it should be faster now (and still correct!) |
let nextPage = 1; | ||
let isMoreDataAvailable = true; | ||
|
||
while (isMoreDataAvailable) { |
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.
Are there risk that hit some rate limitting here? Can we guess how much actual data would be given similar configuration of bbs and test against it?
Asking not blocking.
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.
Good question! 🎯 Probably yes (just like all other Bitbucket API requests), but I think using a pagelen
of 100
mitigates this somewhat (i.e. you'd have to have an incredibly large number of branches in order to get into rate limit territory, and we also do all these requests in sequence and not in parallel).
My feeling here is that it's safe to let any (supposedly very rare / unlikely) rate limit error just bubble up as is if it ever happens, i.e. the Gitpod user would see something like "Unable to fetch branches: Bitbucket API rate limit exceeded".
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.
For repositories we have pagination as well but it broke with 10000 as far as I understand and was very slow to fetch everything breaking ability to create a project.
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.
@akosyakov aha -- was that with pagelen: 100
or the default page length? (Optimizing the page length can divide the number of queries required by ~3x)
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.
I think it was 10K repos with 1000 page size, but we were doing for 2 different properties. @AlexTugarev would be more helpful here, but he is out sick today
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.
Tested with my mirror again (https://bitbucket.org/biased-configuration/gitpod/src/main/) and it seems to work much faster now. Thanks!
@loujaybee good to remove the hold? 🚀 |
I'm happy to trust your judgement on it, @jankeromnes if you think it's a net benefit with minimal or no downside, let's merge 🙏 |
Many thanks @loujaybee! In this case, I'd like to go ahead with merging this fix:
In any case, if there turns out to be a downside to this fix, I'm happy to revert it and improve my fix. 👍 |
/unblock |
/unhold |
Description
Summary generated by Copilot
🤖 Generated by Copilot at f818630
Add pagination support to
listBranches
method ofBitbucketRepositoryProvider
. This allows fetching all the branches for a Bitbucket repository when starting a workspace.Related Issue(s)
Fixes https://linear.app/gitpod/issue/EXP-3/bitbucketorg-support-api-pagination-when-listing-branches
How to test
Documentation
Preview status
Gitpod was successfully deployed to your preview environment.
Build Options
Build
Run the build with werft instead of GHA
Run Leeway with
--dont-test
Publish
Installer
Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh
. If enabled,with-preview
andwith-large-vm
will be enabled./hold