From d0aacfddb796c00f5a49555c8aa34c7866fc3a6a Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Thu, 4 Jun 2020 14:12:20 -0700 Subject: [PATCH] one more spot --- controller/PostgreSQL.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/controller/PostgreSQL.cpp b/controller/PostgreSQL.cpp index 87d3db7e4..0f5fde77b 100644 --- a/controller/PostgreSQL.cpp +++ b/controller/PostgreSQL.cpp @@ -485,18 +485,20 @@ void PostgreSQL::initializeMembers(PGconn *conn) deletes.insert(key); } - if (_rc->clusterMode) { - auto tx = _cluster->transaction(_myAddressStr, true); - for (std::string k : deletes) { - tx.del(k); + if (!deletes.empty()) { + if (_rc->clusterMode) { + auto tx = _cluster->transaction(_myAddressStr, true); + for (std::string k : deletes) { + tx.del(k); + } + tx.exec(); + } else { + auto tx = _redis->transaction(true); + for (std::string k : deletes) { + tx.del(k); + } + tx.exec(); } - tx.exec(); - } else { - auto tx = _redis->transaction(true); - for (std::string k : deletes) { - tx.del(k); - } - tx.exec(); } }