You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2022/04/27 22:23:03 UTC

[GitHub] [helix] junkaixue commented on a diff in pull request #2065: fix bug where generateJobList would iterate until the parallelism is reached

junkaixue commented on code in PR #2065:
URL: https://github.com/apache/helix/pull/2065#discussion_r860286211


##########
helix-core/src/main/java/org/apache/helix/task/RuntimeJobDag.java:
##########
@@ -198,11 +198,15 @@ public void generateJobList() {
     resetJobListAndDependencyMaps();
     computeIndependentNodes();
     _readyJobList.addAll(_independentNodes);
-    if (_isJobQueue && _readyJobList.size() > 0) {
+    if (_isJobQueue && !_readyJobList.isEmpty()) {

Review Comment:
   Not quite sure whether this is just a style change? If we dont change it, would it cause any problem?



##########
helix-core/src/main/java/org/apache/helix/task/RuntimeJobDag.java:
##########
@@ -198,11 +198,15 @@ public void generateJobList() {
     resetJobListAndDependencyMaps();
     computeIndependentNodes();
     _readyJobList.addAll(_independentNodes);
-    if (_isJobQueue && _readyJobList.size() > 0) {
+    if (_isJobQueue && !_readyJobList.isEmpty()) {
       // For job queue, only get number of parallel jobs to run in the ready list.
       for (int i = 1; i < _numParallelJobs; i++) {
-        if (_parentsToChildren.containsKey(_readyJobList.peekLast())) {
-          _readyJobList.offer(_parentsToChildren.get(_readyJobList.peekLast()).iterator().next());
+        String parent = _readyJobList.peekLast();
+        Set<String> children = _parentsToChildren.get(parent);
+        if (children != null) {
+          _readyJobList.offer(children.iterator().next());
+        } else {
+          break;

Review Comment:
   NIT: it would be better make it as:
   
   if (children == null) {
   break;
   } 
   
   _readyJobList.offer(children.iterator().next());



-- 
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: reviews-unsubscribe@helix.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org