diff --git a/src/graph/service/GraphService.cpp b/src/graph/service/GraphService.cpp index 9afa795ca3f..4deaafc372b 100644 --- a/src/graph/service/GraphService.cpp +++ b/src/graph/service/GraphService.cpp @@ -80,7 +80,7 @@ folly::Future GraphService::future_authenticate(const std::string& return future; } - if (!sessionManager_->isOutOfConnections()) { + if (sessionManager_->isOutOfConnections()) { ctx->resp().errorCode = ErrorCode::E_TOO_MANY_CONNECTIONS; ctx->resp().errorMsg.reset(new std::string("Too many connections in the cluster")); ctx->finish(); diff --git a/src/graph/session/GraphSessionManager.h b/src/graph/session/GraphSessionManager.h index bea57661163..e3ea108f4bf 100644 --- a/src/graph/session/GraphSessionManager.h +++ b/src/graph/session/GraphSessionManager.h @@ -48,15 +48,15 @@ class GraphSessionManager final : public SessionManager { folly::Future>> createSession( const std::string userName, const std::string clientIp, folly::Executor* runner) override; - // Whether not exceeds the max allowed connections. + // Whether exceeds the max allowed connections. bool isOutOfConnections() { if (activeSessions_.size() >= static_cast(FLAGS_max_allowed_connections)) { LOG(INFO) << "The sessions of the cluster has more than " "max_allowed_connections: " << FLAGS_max_allowed_connections; - return false; + return true; } - return true; + return false; } // Removes a session from both local and meta server.