Commit 9be73494 authored by jan.koester's avatar jan.koester
Browse files

test

parent 51198080
Loading
Loading
Loading
Loading
Loading
+4 −1
Changes for src/backends/cluster.cpp: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -101,7 +101,10 @@ namespace authdb {
            if (client) {
                try {
                    auto &cmtx = g_Cluster->getClientMutex();
                    std::unique_lock<std::timed_mutex> lock(cmtx, std::chrono::seconds(1));
                    // Use try_to_lock: this runs under the exclusive backend
                    // lock, so any blocking here starves shared readers and
                    // causes "backend shared lock timeout" on other threads.
                    std::unique_lock<std::timed_mutex> lock(cmtx, std::try_to_lock);
                    if (lock.owns_lock()) {
                        peer_data = client->retrieve(dgid);
                        _LastPeerFetch = now;
+7 −2
Changes for src/session.cpp: 7 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -514,11 +514,16 @@ const authdb::SessionData *authdb::ClusterSession::getSession(uuid::uuid session
                cur->_username = c_username;
                cur->setGPOResults(c_gpo);
                cur->_lastClusterSync = std::chrono::steady_clock::now();
            } else {
                // Session was removed from cluster by another node — remove locally
            } else if (!g_Cluster->isDegraded() && !g_Cluster->isCritical()) {
                // Only remove if cluster is fully healthy — an empty retrieve
                // on a degraded cluster doesn't prove the session was deleted.
                std::cerr << "[SESSION] getSession: session removed from cluster, removing locally" << std::endl;
                removeLocal(sessionid);
                return nullptr;
            } else {
                // Cluster degraded/critical: keep local session, retry later
                std::cerr << "[SESSION] getSession: cluster degraded, keeping local session" << std::endl;
                cur->_lastClusterSync = std::chrono::steady_clock::now();
            }
        } catch (const std::exception &e) {
            std::cerr << "[SESSION] getSession: cluster sync error: " << e.what()