-
Notifications
You must be signed in to change notification settings - Fork 49
feat(build:list): add --no-limit option and fix duplicate builds for … #540
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(build:list): add --no-limit option and fix duplicate builds for … #540
Conversation
…non-divisible limits
JoeColeman95
left a comment
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.
Hey @sbamaraa,
Thanks for the PR!
One thing that stands out here is the removal of page size on this – which may have a negative impact on the desired outcome of this PR.
By default, the Buildkite API will return 30 builds if no page size is specified, with a maximum of 100 builds per page. This can be found in our docs here: https://buildkite.com/docs/apis/rest-api#pagination
Looking into the PR, the flag in the helper states it sets this to 500, but I can't see this being done anywhere, with the page limit being stripped entirely, defaulting the results to 30 results per page when --no-limit is, or isn't used.
It may be worth simply tweaking the const for maxBuildLimit as that seems to be the main issue you're facing? (Other than dupes in results) The rationale would be to prevent any potential infinite loops here, and to also preserve some form of throttling.
Not opposed to --no-limit entirely, but I am concerned about the infinite loop in it's current state. It's just the page size being removed that I'm flagging primarily.
|
@sbamaraa I don't know how difficult it is to implement |
Would be happy to implement that logic, again any thoughts on it @JoeColeman95? |
|
@sbamaraa - apologies, I was out of office yesterday. I will take a further look at this PR for you today! |
|
@sbamaraa - I've added pagination back with my suggestions and reworked the logic slightly to add infinite loop prevention measures, and removed the 500 page size entry on the flag. The bulk of your changes were already great, so they remain untouched. With some testing on my end, I can see that this is achieving exactly what you set out for based off of the PR description, if you could ensure that you're happy with the suggested changes? If so, commit them and request a re-review and I'll approve. Otherwise, feel free to make any change(s) and I can re-review |
4ef8df0 to
6bad2ae
Compare
|
I have made more changes to the PR :), additionally now it prints the results immediately after fetching. it helps debug much efficiently. Also bunch of counter have been added to the "Loading spinner" |
I really need to polish this PR before you reviewing it. Update: has been polished now. Please review it. |
7b47fa8 to
76d21e9
Compare
d317972 to
bb7f15d
Compare
|
Hey @sbamaraa, Looks great! 🙂 The only thing we need here is the PageSize setting to 100 using the constant we have, as this will still use the default page size of 30 builds which should improve performance. We're getting a lint error due to the unchecked usage of Spinner: |
|
Thanks for the review! ✅
If no more comments, we can merge it :) |
|
Thanks for the contribution @sbamaraa 😄 |
…non-divisible limits
Add
--no-limitOption:Users can now specify
--no-limitto fetch all builds that match the provided criteria.The command will continue fetching until all available builds are retrieved, making it easier to work with large datasets or when the total number of builds is unknown.
Fix for Non-Divisible Limits:
Previously, if the requested limit was not a multiple of the page size (e.g., 230 with a page size of 100), the command could return duplicate builds due to overlapping page boundaries.
The fetching logic has been corrected to ensure that only unique builds are returned, and the total count matches the requested limit.
Acknowledge logic from user when fetching more than certain number of requests.
When user fetches maxBuildLimit number of builds through the API, now it asks acknowledgement.
Loading spanner has more info
Now it shows how many raw builds have been fetched + how many actually matches the client side filter.
Builds are displayed as soon as it is fetched
Instead of displaying all the builds all at once after the command is finished, now it prints them immediately.