Commit 245b4244 authored by jan.koester's avatar jan.koester
Browse files

test

parent f5cda7bb
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -504,8 +504,8 @@ namespace authdb {
            }
            if (!running_ || !pclient_) continue;
            try {
                std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(2));
                if (!lock.owns_lock()) continue;
                std::unique_lock<std::timed_mutex> lock(client_mutex_, std::try_to_lock);
                if (!lock.owns_lock()) continue;  // skip cycle, don't fight session ops
                auto health = pclient_->get_cluster_status();
                if (health.nodes_online >= n) {
                    if (degraded_) {
+4 −2
Original line number Diff line number Diff line
@@ -482,11 +482,13 @@ const authdb::SessionData *authdb::ClusterSession::addSession(AuthBackend &backe
        appendLocal(newSession);
    }

    // Push to cluster for replication
    if (g_Cluster && g_Cluster->isRunning()) {
    // Push to cluster for replication (skip when degraded — session is in local cache)
    if (g_Cluster && g_Cluster->isRunning() && !g_Cluster->isDegraded()) {
        std::cerr << "[SESSION] addSession: pushing to cluster" << std::endl;
        g_Cluster->pushSession(*newSession);
        std::cerr << "[SESSION] addSession: push done" << std::endl;
    } else if (g_Cluster && g_Cluster->isDegraded()) {
        std::cerr << "[SESSION] addSession: skipping cluster push (degraded)" << std::endl;
    }

    return newSession;