Skip to content

Commit

Permalink
add try catch in swtich for no core
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyShi22 committed Mar 21, 2024
1 parent 033ff7a commit b729daa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion bcos-scheduler/src/BlockExecutive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,8 @@ void BlockExecutive::asyncCommit(std::function<void(Error::UniquePtr)> callback)
++status->failed;
SCHEDULER_LOG(ERROR)
<< BLOCK_NUMBER(number())
<< "asyncPrepare executor failed: " << error->what();
<< "asyncPrepare executor failed: "
<< LOG_KV("code", error->errorCode()) << error->what();

if (error->errorCode() ==
bcos::executor::ExecuteError::SCHEDULER_TERM_ID_ERROR)
Expand Down
15 changes: 13 additions & 2 deletions bcos-scheduler/src/SchedulerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,19 @@ void SchedulerManager::asyncSwitchTerm(
// Will update scheduler session, clear all scheduler & executor block pipeline cache and
// re-dispatch executor
m_pool.enqueue([this, callback = std::move(callback), schedulerSeq]() {
switchTerm(schedulerSeq);
callback(nullptr);
try
{
switchTerm(schedulerSeq);
callback(nullptr);
}
catch (std::exception const& _e)
{
SCHEDULER_LOG(ERROR) << "asyncSwitchTerm failed" << boost::diagnostic_information(_e);
}
catch (...)
{
SCHEDULER_LOG(ERROR) << "asyncSwitchTerm failed";
}
});
}

Expand Down

0 comments on commit b729daa

Please sign in to comment.