Skip to content

Commit

Permalink
Handle errors on the graph side
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiee committed Jan 10, 2023
1 parent 261a908 commit 68f75b8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/graph/session/GraphSessionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,7 @@ void GraphSessionManager::updateSessionsToMeta() {
// There may be expired queries, and the
// expired queries will be killed here.
auto handleKilledQueries = [this](auto&& resp) {
if (!resp.ok()) {
LOG(ERROR) << "Update sessions failed: " << resp.status();
return Status::Error("Update sessions failed: %s", resp.status().toString().c_str());
}
DCHECK(resp.ok());
auto& killedQueriesForEachSession = *resp.value().killed_queries_ref();
for (auto& killedQueries : killedQueriesForEachSession) {
auto sessionId = killedQueries.first;
Expand All @@ -276,20 +273,22 @@ void GraphSessionManager::updateSessionsToMeta() {
VLOG(1) << "Kill query, session: " << sessionId << " plan: " << epId;
}
}
return Status::OK();
};

// The response from meta contains sessions that are marked as killed, so we need to clean the
// local cache and update statistics
auto handleKilledSessions = [this](auto&& resp) {
DCHECK(resp.ok());
auto killSessions = resp.value().get_killed_sessions();
removeSessionFromLocalCache(killSessions);
};

auto result = metaClient_->updateSessions(sessions).get();
if (!result.ok()) {
LOG(ERROR) << "Update sessions failed: " << result;
return;
}

handleKilledQueries(result);
handleKilledSessions(result);
}
Expand Down

0 comments on commit 68f75b8

Please sign in to comment.