asdf2014 commented on a change in pull request #6991: run pending tasks when 
assigned a task that is already pending
URL: https://github.com/apache/incubator-druid/pull/6991#discussion_r273339908
 
 

 ##########
 File path: 
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java
 ##########
 @@ -315,6 +320,16 @@ public String apply(Task task)
     }
   }
 
+  private boolean isTaskPending(Task task)
+  {
+    for (TaskRunnerWorkItem workItem : taskRunner.getPendingTasks()) {
+      if (workItem.getTaskId().equals(task.getId())) {
+        return true;
+      }
+    }
+    return false;
 
 Review comment:
   `task.getId()` shouldn't be called by each for loop, and it would be better 
to change this method to a lambda style.
   
   ```java
   final String taskId = task.getId();
   return taskRunner.getPendingTasks()
                    .stream()
                    .anyMatch(t -> taskId.equals(t.getTaskId()));
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to