You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "christophd (via GitHub)" <gi...@apache.org> on 2023/03/21 10:37:14 UTC

[GitHub] [camel] christophd commented on a diff in pull request #9589: CAMEL-19174: camel-jira - Fix duplicate messages created by Jira consumer

christophd commented on code in PR #9589:
URL: https://github.com/apache/camel/pull/9589#discussion_r1143179666


##########
components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/AbstractJiraConsumer.java:
##########
@@ -79,18 +79,28 @@ protected List<Issue> getIssues() {
     protected List<Issue> getIssues(String jql, int start, int maxPerQuery, int maxResults) {
         LOG.debug("Start indexing current JIRA issues...");
 
+        if (maxResults < maxPerQuery) {
+            maxPerQuery = maxResults;
+        }
+
         List<Issue> issues = new ArrayList<>();
         while (true) {
             SearchRestClient searchRestClient = endpoint.getClient().getSearchClient();
-            SearchResult searchResult = searchRestClient.searchJql(jql, maxResults, start, null).claim();
+            SearchResult searchResult = searchRestClient.searchJql(jql, maxPerQuery, start, null).claim();
 
             for (Issue issue : searchResult.getIssues()) {
-                issues.add(issue);
+                // Avoid duplicates
+                if (!issues.contains(issue)) {
+                    issues.add(issue);

Review Comment:
   @essobedo thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org