From fbe28b71009eb6579b87c14bd6ce7f940b5884a3 Mon Sep 17 00:00:00 2001 From: Shylock Hg <33566796+Shylock-Hg@users.noreply.github.com> Date: Wed, 27 May 2020 15:59:30 +0800 Subject: [PATCH] Unify the go exit entry. --- src/graph/GoExecutor.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/graph/GoExecutor.cpp b/src/graph/GoExecutor.cpp index 85398dbd4c3..bac1ed1e02a 100644 --- a/src/graph/GoExecutor.cpp +++ b/src/graph/GoExecutor.cpp @@ -576,24 +576,27 @@ void GoExecutor::stepOut() { std::move(future).via(runner).thenValue(cb).thenError(error); } +#define GO_EXIT() \ + do { \ + if (records_.empty()) { \ + onEmptyInputs(); \ + return; \ + } else { \ + maybeFinishExecution(); \ + return; \ + } \ + } while (0); void GoExecutor::onStepOutResponse(RpcResponse &&rpcResp) { joinResp(std::move(rpcResp)); if (isFinalStep()) { - maybeFinishExecution(); - return; + GO_EXIT(); } else { auto dsts = getDstIdsFromResps(records_.end() - 1, records_.end()); starts_ = std::move(dsts); if (starts_.empty()) { - if (curStep_ < recordFrom_) { - onEmptyInputs(); - return; - } else { - maybeFinishExecution(); - return; - } + GO_EXIT(); } curStep_++; stepOut();