Loading src/cluster.cpp +5 −18 Original line number Diff line number Diff line Loading @@ -678,24 +678,11 @@ namespace authdb { void Cluster::pushSession(const SessionData &sess) { if (!session_client_) return; auto data = SessionBlock::serialize(sess); uuid::uuid sid; sess.getSid(sid); uint64_t sid_gid = sidGroupId(sid); if (interceptor_) interceptor_->mark_session_group(sid_gid); for (int attempt = 0; attempt < 3; ++attempt) { try { session_client_->store(sid_gid, data.data(), data.size()); return; } catch (const std::exception &e) { if (attempt < 2) std::this_thread::sleep_for(std::chrono::milliseconds(200)); } } throw AuthBackendError("cluster busy — session push failed after 3 retries"); // Queue asynchronously — the session is already cached locally so // getSession() will find it immediately via findLocal(). The push // worker thread will replicate to the cluster without blocking the // caller (login request). queuePush(sess); } void Cluster::queuePush(const SessionData &sess) { Loading src/session.cpp +5 −9 Original line number Diff line number Diff line Loading @@ -433,19 +433,15 @@ const authdb::SessionData *authdb::ClusterSession::addSession(AuthBackend &backe uuid::uuid newSid; newSession->getSid(newSid); // Push to cluster try { g_Cluster->pushSession(*newSession); } catch (const std::exception &e) { delete newSession; throw AuthBackendError("session could not be stored in cluster — please try again"); } // Keep pointer alive for callers // Keep pointer alive for callers (local cache serves immediate lookups) { std::lock_guard<std::mutex> guard(_lock); appendLocal(newSession); } // Queue async push to cluster — session is already in local cache g_Cluster->pushSession(*newSession); return newSession; } Loading Loading
src/cluster.cpp +5 −18 Original line number Diff line number Diff line Loading @@ -678,24 +678,11 @@ namespace authdb { void Cluster::pushSession(const SessionData &sess) { if (!session_client_) return; auto data = SessionBlock::serialize(sess); uuid::uuid sid; sess.getSid(sid); uint64_t sid_gid = sidGroupId(sid); if (interceptor_) interceptor_->mark_session_group(sid_gid); for (int attempt = 0; attempt < 3; ++attempt) { try { session_client_->store(sid_gid, data.data(), data.size()); return; } catch (const std::exception &e) { if (attempt < 2) std::this_thread::sleep_for(std::chrono::milliseconds(200)); } } throw AuthBackendError("cluster busy — session push failed after 3 retries"); // Queue asynchronously — the session is already cached locally so // getSession() will find it immediately via findLocal(). The push // worker thread will replicate to the cluster without blocking the // caller (login request). queuePush(sess); } void Cluster::queuePush(const SessionData &sess) { Loading
src/session.cpp +5 −9 Original line number Diff line number Diff line Loading @@ -433,19 +433,15 @@ const authdb::SessionData *authdb::ClusterSession::addSession(AuthBackend &backe uuid::uuid newSid; newSession->getSid(newSid); // Push to cluster try { g_Cluster->pushSession(*newSession); } catch (const std::exception &e) { delete newSession; throw AuthBackendError("session could not be stored in cluster — please try again"); } // Keep pointer alive for callers // Keep pointer alive for callers (local cache serves immediate lookups) { std::lock_guard<std::mutex> guard(_lock); appendLocal(newSession); } // Queue async push to cluster — session is already in local cache g_Cluster->pushSession(*newSession); return newSession; } Loading