Skip to content

Commit

Permalink
fix session error
Browse files Browse the repository at this point in the history
  • Loading branch information
songqing committed Sep 4, 2023
1 parent 1af0ff7 commit 5c500ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions include/nebula/client/Session.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ class Session {
return toLocal(data, offsetSecs_);
}

bool isSessionError(const ExecutionResponse &resp) {
return resp.errorCode == ErrorCode::E_SESSION_INVALID ||
resp.errorCode == ErrorCode::E_SESSION_NOT_FOUND ||
resp.errorCode == ErrorCode::E_SESSION_TIMEOUT;
}

// convert the time to specific time zone
static void toLocal(DataSet &data, int32_t offsetSecs);

Expand Down
2 changes: 1 addition & 1 deletion src/client/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ExecutionResponse Session::executeWithParameter(
auto resp = conn_.executeWithParameter(sessionId_, stmt, parameters);
if (resp.errorCode == nebula::ErrorCode::SUCCEEDED) {
return resp;
} else if (resp.errorCode == nebula::ErrorCode::E_FAIL_TO_CONNECT) {
} else if (resp.errorCode == nebula::ErrorCode::E_FAIL_TO_CONNECT || isSessionError(resp)) {
connectionIsBroken_ = true;
if (retryConnect_) {
if (retryConnect() == nebula::ErrorCode::SUCCEEDED) {
Expand Down

0 comments on commit 5c500ca

Please sign in to comment.