Skip to content

Commit

Permalink
fix: collect all process definitions before extracting inbound connec…
Browse files Browse the repository at this point in the history
…tors (#1077)
  • Loading branch information
markfarkas-camunda committed Aug 28, 2023
1 parent ce0edef commit 38413f5
Showing 1 changed file with 9 additions and 5 deletions.
Expand Up @@ -53,26 +53,30 @@ public ProcessDefinitionSearch(CamundaOperateClient camundaOperateClient) {

public void query(Consumer<List<ProcessDefinition>> resultHandler) {
LOG.trace("Query process deployments...");
SearchResult<ProcessDefinition> result;
List<ProcessDefinition> processDefinitions = new ArrayList<>();
SearchResult<ProcessDefinition> processDefinitionResult;
LOG.trace("Running paginated query");
do {
try {
// automatically sorted by process definition key, i.e. in chronological order of deployment
SearchQuery processDefinitionQuery =
new SearchQuery.Builder().searchAfter(paginationIndex).size(20).build();
result = camundaOperateClient.search(processDefinitionQuery, ProcessDefinition.class);
processDefinitionResult =
camundaOperateClient.search(processDefinitionQuery, ProcessDefinition.class);
} catch (OperateException e) {
throw new RuntimeException(e);
}
List<Object> newPaginationIdx = result.getSortValues();
List<Object> newPaginationIdx = processDefinitionResult.getSortValues();

if (!CollectionUtils.isEmpty(newPaginationIdx)) {
paginationIndex = newPaginationIdx;
}

resultHandler.accept(result.getItems());
processDefinitions.addAll(processDefinitionResult.getItems());

} while (result.getItems().size() > 0);
} while (processDefinitionResult.getItems().size() > 0);

resultHandler.accept(processDefinitions);
}

/**
Expand Down

0 comments on commit 38413f5

Please sign in to comment.