Skip to content

Commit

Permalink
Add inturrupt to path writer (#4609)
Browse files Browse the repository at this point in the history
* Add inturrupt to path writer

* Run clang-format

---------

Co-authored-by: CI Bot <[email protected]>
  • Loading branch information
andyfengHKU and andyfengHKU authored Dec 9, 2024
1 parent aa102a0 commit c0b194c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/function/gds/output_writer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "function/gds/output_writer.h"

#include "common/exception/interrupt.h"
#include "function/gds/gds_frontier.h"
#include "main/client_context.h"

Expand Down Expand Up @@ -108,6 +109,9 @@ void PathsOutputWriter::write(processor::FactorizedTable& fTable, nodeID_t dstNo
if (!info.hasNodeMask() && info.semantic == common::PathSemantic::WALK) {
// Fast path when there is no node predicate or semantic check
while (!curPath.empty()) {
if (context->interrupted()) {
throw InterruptException{};
}
auto top = curPath[curPath.size() - 1];
auto topNodeID = top->getNodeID();
if (top->getIter() == 1) {
Expand Down Expand Up @@ -144,6 +148,9 @@ void PathsOutputWriter::write(processor::FactorizedTable& fTable, nodeID_t dstNo
return;
}
while (!curPath.empty()) {
if (context->interrupted()) {
throw InterruptException{};
}
if (getTop(curPath)->getIter() == 1) {
writePath(curPath);
fTable.append(vectors);
Expand Down

0 comments on commit c0b194c

Please sign in to comment.