Commit 91696ca8 authored by jan.koester's avatar jan.koester
Browse files

test

parent 629e4a30
Loading
Loading
Loading
Loading
Loading
+13 −1
Changes for src/admin.cpp: 13 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -598,8 +598,20 @@ namespace authdb {

            auto &pclient = g_Cluster->getClient();
            if (pclient) {
                // Fetch cluster health under mutex, then release immediately
                // to avoid blocking session/replication operations during JSON build
                decltype(pclient->get_cluster_status()) health;
                try {
                    std::lock_guard<std::mutex> lock(g_Cluster->getClientMutex());
                auto health = pclient->get_cluster_status();
                    health = pclient->get_cluster_status();
                } catch (...) {
                    json_object_object_add(jobj, "status", json_object_new_string("UNAVAILABLE"));
                    json_object_object_add(jobj, "nodes_total", json_object_new_int(0));
                    json_object_object_add(jobj, "nodes_online", json_object_new_int(0));
                    sendJson(curreq, jobj);
                    json_object_put(jobj);
                    return;
                }

                uint32_t total = health.nodes_total;
                uint32_t online = health.nodes_online;