Commit 72e2cd7b authored by jan.koester's avatar jan.koester
Browse files

test

parent b4f11186
Loading
Loading
Loading
Loading
Loading
+8 −8
Changes for src/cluster.cpp: 8 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -392,7 +392,7 @@ namespace authdb {

        // Replicate raw data to all peer nodes under both keys
        try {
            std::lock_guard<std::mutex> lock(client_mutex_);
            std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout");
            pclient_->replicate_to_peers(sgid, 0, data.data(), data.size());
            pclient_->replicate_to_peers(sid_gid, 0, data.data(), data.size());
        } catch (const netplus::NetException &e) {
@@ -420,7 +420,7 @@ namespace authdb {
        // Try to fetch from peer nodes
        if (pclient_) {
            try {
                std::lock_guard<std::mutex> lock(client_mutex_);
                std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout");
                if (pclient_->fetch_from_peers(sgid, 0, data) && !data.empty()) {
                    uuid::uuid d_uid, d_did;
                    if (SessionBlock::deserialize(data, sid, d_uid, d_did, members, username, gpo_results)) {
@@ -452,7 +452,7 @@ namespace authdb {
                store_->remove_group(sid_gid);
                if (pclient_) {
                    try {
                        std::lock_guard<std::mutex> lock(client_mutex_);
                        std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout");
                        pclient_->remove(sid_gid);
                    } catch (...) {}
                }
@@ -464,7 +464,7 @@ namespace authdb {

        if (pclient_) {
            try {
                std::lock_guard<std::mutex> lock(client_mutex_);
                std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout");
                pclient_->remove(sgid);
            } catch (...) {}
        }
@@ -480,7 +480,7 @@ namespace authdb {
        // Check peer nodes
        if (pclient_) {
            try {
                std::lock_guard<std::mutex> lock(client_mutex_);
                std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout");
                if (pclient_->fetch_from_peers(sgid, 0, data) && !data.empty())
                    return true;
            } catch (...) {}
@@ -499,7 +499,7 @@ namespace authdb {
        // Check peer nodes
        if (pclient_) {
            try {
                std::lock_guard<std::mutex> lock(client_mutex_);
                std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout");
                if (pclient_->fetch_from_peers(sid_gid, 0, data) && !data.empty())
                    return true;
            } catch (...) {}
@@ -526,7 +526,7 @@ namespace authdb {
        // Try to fetch from peer nodes
        if (pclient_) {
            try {
                std::lock_guard<std::mutex> lock(client_mutex_);
                std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout");
                if (pclient_->fetch_from_peers(sid_gid, 0, data) && !data.empty()) {
                    if (SessionBlock::deserialize(data, sid, uid, did, members, username, gpo_results)) {
                        // Cache locally
@@ -674,7 +674,7 @@ namespace authdb {

        // Replicate to all peer nodes
        try {
            std::lock_guard<std::mutex> lock(client_mutex_);
            std::unique_lock<std::timed_mutex> lock(client_mutex_, std::chrono::seconds(5)); if (!lock.owns_lock()) throw std::runtime_error("cluster client lock timeout");
            pclient_->replicate_to_peers(localId, 0, data.data(), data.size());
        } catch (const netplus::NetException &e) {
            std::cerr << "Cluster replicate failed: " << e.what() << std::endl;