Skip to content

Commit

Permalink
fix a bug may stuck (#3306)
Browse files Browse the repository at this point in the history
* fix a bug may stuck

* update

Co-authored-by: Yee <[email protected]>
  • Loading branch information
liuyu85cn and yixinglu authored Nov 12, 2021
1 parent a5ca6e5 commit 2c1d720
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/storage/transaction/ChainAddEdgesProcessorLocal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,25 @@ folly::SemiFuture<Code> ChainAddEdgesProcessorLocal::forwardToDelegateProcessor(
};
auto futProc = proc->getFuture();
auto [pro, fut] = folly::makePromiseContract<Code>();
std::move(futProc).thenValue([&, p = std::move(pro)](auto&& resp) mutable {
auto rc = extractRpcError(resp);
if (rc == Code::SUCCEEDED) {
if (FLAGS_trace_toss) {
for (auto& k : kvErased_) {
VLOG(1) << uuid_ << " erase prime " << folly::hexlify(k);
std::move(futProc).thenTry([&, p = std::move(pro)](auto&& t) mutable {
auto rc = Code::SUCCEEDED;
if (t.hasException()) {
LOG(INFO) << "catch ex: " << t.exception().what();
rc = Code::E_UNKNOWN;
} else {
auto& resp = t.value();
rc = extractRpcError(resp);
if (rc == Code::SUCCEEDED) {
if (FLAGS_trace_toss) {
for (auto& k : kvErased_) {
VLOG(1) << uuid_ << " erase prime " << folly::hexlify(k);
}
}
} else {
VLOG(1) << uuid_ << " forwardToDelegateProcessor(), code = "
<< apache::thrift::util::enumNameSafe(rc);
addUnfinishedEdge(ResumeType::RESUME_CHAIN);
}
} else {
VLOG(1) << uuid_
<< " forwardToDelegateProcessor(), code = " << apache::thrift::util::enumNameSafe(rc);
addUnfinishedEdge(ResumeType::RESUME_CHAIN);
}
p.setValue(rc);
});
Expand Down

0 comments on commit 2c1d720

Please sign in to comment.