Just increment the page number instead of using the X-Next-Page header for retrieving all open MRs (Fixes #358)
This commit is contained in:
parent
6247055edb
commit
5435cfcee9
|
@ -58,14 +58,14 @@ class OpenMergeRequestPushHookTriggerHandler implements PushHookTriggerHandler {
|
|||
|
||||
private List<MergeRequest> getOpenMergeRequests(GitLabApi client, String projectId) {
|
||||
List<MergeRequest> result = new ArrayList<>();
|
||||
Integer page = 0;
|
||||
Integer page = 1;
|
||||
do {
|
||||
Response response = null;
|
||||
try {
|
||||
response = client.getMergeRequests(projectId, State.opened, page, 100);
|
||||
result.addAll(response.readEntity(new GenericType<List<MergeRequest>>() {}));
|
||||
String nextPage = response.getHeaderString("X-Next-Page");
|
||||
page = nextPage.isEmpty() ? null : Integer.valueOf(nextPage);
|
||||
List<MergeRequest> mergeRequests = response.readEntity(new GenericType<List<MergeRequest>>() {});
|
||||
result.addAll(mergeRequests);
|
||||
page = mergeRequests.isEmpty() ? null : page + 1;
|
||||
} finally {
|
||||
if (response != null) {
|
||||
response.close();
|
||||
|
|
Loading…
Reference in New Issue