Commit a8c3475e authored by jan.koester's avatar jan.koester
Browse files

test

parent 2fee444a
Loading
Loading
Loading
Loading
Loading
+12 −10
Changes for src/cluster.cpp: 12 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -429,14 +429,6 @@ namespace authdb {
    void Cluster::start() {
        if (running_) return;
        running_ = true;

        // Warm up session_client_ dead_until cache so first request doesn't block
        if (session_client_) {
            try {
                session_client_->get_cluster_status();
            } catch (...) {}
        }

        server_thread_ = std::thread(&Cluster::server_loop, this);
        health_monitor_thread_ = std::thread(&Cluster::health_monitor_loop, this);
        push_worker_thread_ = std::thread(&Cluster::push_worker_loop, this);
@@ -536,9 +528,19 @@ namespace authdb {
            try {
                auto health = pclient_->get_cluster_status();

                // Keep session_client_ dead_until cache warm
                // Propagate dead node info to session_client_
                if (session_client_) {
                    try { session_client_->get_cluster_status(); } catch (...) {}
                    for (auto &[idx, st] : health.node_statuses) {
                        // node_statuses only contains reachable nodes
                    }
                    // Mark unreachable nodes as dead in session_client_
                    std::set<size_t> online_nodes;
                    for (auto &[idx, st] : health.node_statuses)
                        online_nodes.insert(idx);
                    for (size_t i = 0; i < n; ++i) {
                        if (online_nodes.find(i) == online_nodes.end())
                            session_client_->mark_node_dead(i);
                    }
                }

                bool was_degraded = degraded_;