summaryrefslogtreecommitdiff
path: root/controller/PostgreSQL.cpp
diff options
context:
space:
mode:
authorGrant Limberg <[email protected]>2022-06-30 09:46:38 -0700
committerGrant Limberg <[email protected]>2022-06-30 09:59:47 -0700
commitb5d7d71e1e78fd34e6976e210bf0021994ba4746 (patch)
treecbdeb00840f6026e49fa100436e3d8ddbffcdaab /controller/PostgreSQL.cpp
parent6fdc7be502d5251065400f89129bba5a7ecc9a3e (diff)
use connection pool instead of new connection for member status writes
redis plus plus has an annoying feature where it will open a new connection for each tx or pipeline by default, rather than just fetching an existing connection from the pool. Let's change that
Diffstat (limited to 'controller/PostgreSQL.cpp')
-rw-r--r--controller/PostgreSQL.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/controller/PostgreSQL.cpp b/controller/PostgreSQL.cpp
index 8e265da3..28418ec3 100644
--- a/controller/PostgreSQL.cpp
+++ b/controller/PostgreSQL.cpp
@@ -710,11 +710,11 @@ void PostgreSQL::initializeNetworks()
if (_redisMemberStatus) {
fprintf(stderr, "adding networks to redis...\n");
if (_rc->clusterMode) {
- auto tx = _cluster->transaction(_myAddressStr, true);
+ auto tx = _cluster->transaction(_myAddressStr, true, false);
tx.sadd(setKey, networkSet.begin(), networkSet.end());
tx.exec();
} else {
- auto tx = _redis->transaction(true);
+ auto tx = _redis->transaction(true, false);
tx.sadd(setKey, networkSet.begin(), networkSet.end());
tx.exec();
}
@@ -766,13 +766,13 @@ void PostgreSQL::initializeMembers()
if (!deletes.empty()) {
try {
if (_rc->clusterMode) {
- auto tx = _cluster->transaction(_myAddressStr, true);
+ auto tx = _cluster->transaction(_myAddressStr, true, false);
for (std::string k : deletes) {
tx.del(k);
}
tx.exec();
} else {
- auto tx = _redis->transaction(true);
+ auto tx = _redis->transaction(true, false);
for (std::string k : deletes) {
tx.del(k);
}
@@ -926,13 +926,13 @@ void PostgreSQL::initializeMembers()
if (_redisMemberStatus) {
fprintf(stderr, "Load member data into redis...\n");
if (_rc->clusterMode) {
- auto tx = _cluster->transaction(_myAddressStr, true);
+ auto tx = _cluster->transaction(_myAddressStr, true, false);
for (auto it : networkMembers) {
tx.sadd(it.first, it.second);
}
tx.exec();
} else {
- auto tx = _redis->transaction(true);
+ auto tx = _redis->transaction(true, false);
for (auto it : networkMembers) {
tx.sadd(it.first, it.second);
}
@@ -1696,10 +1696,10 @@ void PostgreSQL::onlineNotification_Redis()
try {
if (!lastOnline.empty()) {
if (_rc->clusterMode) {
- auto tx = _cluster->transaction(controllerId, true);
+ auto tx = _cluster->transaction(controllerId, true, false);
count = _doRedisUpdate(tx, controllerId, lastOnline);
} else {
- auto tx = _redis->transaction(true);
+ auto tx = _redis->transaction(true, false);
count = _doRedisUpdate(tx, controllerId, lastOnline);
}
}