Loading src/session.cpp +15 −3 Changes for src/session.cpp: 15 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -442,30 +442,42 @@ const authdb::SessionData *authdb::ClusterSession::addSession(AuthBackend &backe // Create new session SessionData *newSession = createSessionData(backend, domainid, userid); uuid::uuid newSid; newSession->getSid(newSid); std::cerr << "[SESSION] addSession: created sid=" << newSid.c_str() << " uid=" << userid.c_str() << " did=" << domainid.c_str() << std::endl; // Synchronous push to cluster — blocks until stored if (g_Cluster && g_Cluster->isRunning()) { try { g_Cluster->pushSession(*newSession); std::cerr << "[SESSION] addSession: pushSession returned OK" << std::endl; } catch (const std::exception &e) { std::cerr << "[SESSION] addSession: pushSession FAILED: " << e.what() << std::endl; } // Verify session is retrievable from cluster before returning. // This ensures other nodes can serve the session immediately. uuid::uuid newSid; newSession->getSid(newSid); auto deadline = std::chrono::steady_clock::now() + std::chrono::seconds(5); bool verified = false; int attempts = 0; while (std::chrono::steady_clock::now() < deadline) { ++attempts; uuid::uuid v_sid, v_uid, v_did; std::vector<uuid::uuid> v_members; std::string v_username; std::vector<std::pair<uuid::uuid, bool>> v_gpo; if (g_Cluster->fetchSessionBySid(newSid, v_sid, v_uid, v_did, v_members, v_username, v_gpo)) { std::cerr << "[SESSION] addSession: verified after " << attempts << " attempt(s)" << std::endl; verified = true; break; } std::this_thread::sleep_for(std::chrono::milliseconds(100)); } if (!verified) { std::cerr << "[SESSION] addSession: WARNING — session pushed but not verifiable from cluster" << std::endl; std::cerr << "[SESSION] addSession: WARNING — session pushed but not verifiable after " << attempts << " attempts (5s)" << std::endl; } } Loading Loading
src/session.cpp +15 −3 Changes for src/session.cpp: 15 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -442,30 +442,42 @@ const authdb::SessionData *authdb::ClusterSession::addSession(AuthBackend &backe // Create new session SessionData *newSession = createSessionData(backend, domainid, userid); uuid::uuid newSid; newSession->getSid(newSid); std::cerr << "[SESSION] addSession: created sid=" << newSid.c_str() << " uid=" << userid.c_str() << " did=" << domainid.c_str() << std::endl; // Synchronous push to cluster — blocks until stored if (g_Cluster && g_Cluster->isRunning()) { try { g_Cluster->pushSession(*newSession); std::cerr << "[SESSION] addSession: pushSession returned OK" << std::endl; } catch (const std::exception &e) { std::cerr << "[SESSION] addSession: pushSession FAILED: " << e.what() << std::endl; } // Verify session is retrievable from cluster before returning. // This ensures other nodes can serve the session immediately. uuid::uuid newSid; newSession->getSid(newSid); auto deadline = std::chrono::steady_clock::now() + std::chrono::seconds(5); bool verified = false; int attempts = 0; while (std::chrono::steady_clock::now() < deadline) { ++attempts; uuid::uuid v_sid, v_uid, v_did; std::vector<uuid::uuid> v_members; std::string v_username; std::vector<std::pair<uuid::uuid, bool>> v_gpo; if (g_Cluster->fetchSessionBySid(newSid, v_sid, v_uid, v_did, v_members, v_username, v_gpo)) { std::cerr << "[SESSION] addSession: verified after " << attempts << " attempt(s)" << std::endl; verified = true; break; } std::this_thread::sleep_for(std::chrono::milliseconds(100)); } if (!verified) { std::cerr << "[SESSION] addSession: WARNING — session pushed but not verifiable from cluster" << std::endl; std::cerr << "[SESSION] addSession: WARNING — session pushed but not verifiable after " << attempts << " attempts (5s)" << std::endl; } } Loading