javeme commented on code in PR #2281:
URL: 
https://github.com/apache/incubator-hugegraph/pull/2281#discussion_r1297170036


##########
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CountTraverser.java:
##########
@@ -78,19 +78,28 @@ public long count(Id source, List<EdgeStep> steps,
             });
         }
 
-        // The last step, just query count
-        EdgeStep lastStep = steps.get(stepNum - 1);
-        while (edges.hasNext()) {
-            Id target = ((HugeEdge) edges.next()).id().otherVertexId();
-            if (this.dedup(target)) {
-                continue;
+        try {
+            // The last step, just query count
+            EdgeStep lastStep = steps.get(stepNum - 1);
+            while (edges.hasNext()) {
+                Id target = ((HugeEdge) edges.next()).id().otherVertexId();
+                if (this.dedup(target)) {
+                    continue;
+                }
+                // Count last layer vertices(without dedup size)
+                long edgesCount = this.edgesCount(target, lastStep);
+                this.count.add(edgesCount);
             }
-            // Count last layer vertices(without dedup size)
-            long edgesCount = this.edgesCount(target, lastStep);
-            this.count.add(edgesCount);
-        }
 
-        return this.count.longValue();
+            return this.count.longValue();
+        } finally {
+            if (edges instanceof FlatMapperIterator) {

Review Comment:
   we prefer to not ignore exceptions of closeIterator, at least log.warn() it.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to