Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): close flat mapper iterator after usage #2281

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
qwtsc marked this conversation as resolved.
Show resolved Hide resolved
try {
((FlatMapperIterator<?, ?>)edges).close();
} catch (Exception ignored) {
}
}
}
}

private Iterator<Edge> edgesOfVertexWithCount(Id source, EdgeStep step) {
Expand Down