Repository navigation
Fix paged fetch counting the first page twice - #26
Merged
rkosegi merged 1 commit intoOct 15, 2026
Merged
Conversation
PagedResourceHelper.fetchItems started at page 0, but Hetzner Cloud API pages are 1-based and page=0 is served as page 1. Whenever a result spans more than one page, the first page was returned twice, so getAllServers and getAllPrimaryIps reported 25 extra items. Verified against the live API: GET /v1/servers?page=0 returns meta.pagination.page=1 and the same items as page=1. In the Jenkins hetzner-cloud plugin this makes a cloud with 26 servers count as 51, so it hits its instance cap with about half the agents actually running. Start the loop at page 1 and add a test that emulates the API's page=0 behaviour and asserts pages 1..n are requested without duplicates.
|
Contributor
Author
|
@rkosegi could you take a look? |
rkosegi
approved these changes
Oct 15, 2026
Member
|
Hi @lgonczarik, thanks for contribution. Do you mind to also bump version in Jenkins plugin itself? |
6 tasks done
Contributor
Author
Sure, here it is: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



PagedResourceHelper.fetchItems
now starts at page 1 instead of page 0. Multi-page results no longer contain the first page twice, sogetAllServersandgetAllPrimaryIps` return the correct count.Hetzner Cloud API pages are 1-based, and the API serves
page=0as page 1.Checked against the live API:
GET /v1/servers?page=0&per_page=2answers withmeta.pagination.page: 1, next_page: 2and the same servers aspage=1.The old loop therefore read page 1 twice before moving on, adding 25 duplicates once a result spans more than one page.
In the Jenkins hetzner-cloud plugin this makes a cloud with 26 servers count as 51, so it reports "Cloud capacity reached" with about half of the instance cap actually running.
The new test in
BasicTestemulates the API'spage=0behaviour with a mock server and asserts that only pages 1..n are requested and that the result has no duplicates.It fails on the old code (
expected:<[1, 2]> but was:<[0, 1, 2]>) and passes with the fix.