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


##########
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:
   What do you think of leaving it like before and simply replacing the 
`ArrayList` with a `LinkedHashSet` to avoid calling `contains` on a list that 
has a time complexity an `O(n)` vs `O(1)`?



-- 
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-unsubscr...@camel.apache.org

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

Reply via email to