Commit 63fd70cb authored by jan.koester's avatar jan.koester
Browse files

test

parent 3f0a4152
Loading
Loading
Loading
Loading
Loading
+8 −1
Changes for src/session.cpp: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -524,10 +524,17 @@ const authdb::SessionData *authdb::ClusterSession::getSession(uuid::uuid session
        std::cerr << "[SESSION] getSession: sid=" << sessionid.c_str()
                  << " not found in cluster" << std::endl;

        // Return stale cache if available
        // Return stale cache if available — and lazily push it to the cluster
        // so other nodes can find it (heals sessions from before cluster code)
        std::lock_guard<std::mutex> guard(_lock);
        SessionData *stale = findLocal(sessionid);
        if (stale) {
            std::cerr << "[SESSION] getSession: found stale local session, pushing to cluster (lazy heal)" << std::endl;
            try {
                g_Cluster->pushSession(*stale);
            } catch (...) {
                std::cerr << "[SESSION] getSession: lazy heal push failed" << std::endl;
            }
            stale->_lastClusterSync = std::chrono::steady_clock::now();
            return stale;
        }