Commit 64271d7f authored by jan.koester's avatar jan.koester
Browse files

test

parent f3eb0773
Loading
Loading
Loading
Loading
Loading
+1 −17
Original line number Diff line number Diff line
@@ -608,20 +608,8 @@ namespace authdb {

            auto &pclient = g_Cluster->getClient();
            if (pclient) {
                // Use try_lock to avoid blocking the HTTP handler (and other
                // cluster operations) while get_cluster_status() sequentially
                // probes every node — unreachable nodes cause long waits.
                decltype(pclient->get_cluster_status()) health;
                try {
                    std::unique_lock<std::timed_mutex> lock(g_Cluster->getClientMutex(), std::try_to_lock);
                    if (!lock.owns_lock()) {
                        json_object_object_add(jobj, "status", json_object_new_string("BUSY"));
                        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;
                    }
                    health = pclient->get_cluster_status();
                } catch (...) {
                    json_object_object_add(jobj, "status", json_object_new_string("UNAVAILABLE"));
@@ -1762,11 +1750,7 @@ namespace authdb {
                if (pclient) {
                    size_t nodes_ok = 0;
                    try {
                        std::unique_lock<std::timed_mutex> lock(
                            g_Cluster->getClientMutex(), std::try_to_lock);
                        if (lock.owns_lock()) {
                        nodes_ok = pclient->vacuum_all_nodes();
                        }
                    } catch (...) {}
                    json_object_object_add(jobj, "cluster_vacuum",
                                           json_object_new_boolean(true));