summaryrefslogtreecommitdiff
path: root/controller/PostgreSQL.cpp
diff options
context:
space:
mode:
authorGrant Limberg <[email protected]>2022-06-30 11:40:04 -0700
committerGrant Limberg <[email protected]>2022-06-30 11:40:04 -0700
commit9cf8dacfbbab6b9663ba279b8de0a6d3f99a6a4e (patch)
tree749b4b6cf299b325af9d995688cfa2c2f01be3c4 /controller/PostgreSQL.cpp
parentb5d7d71e1e78fd34e6976e210bf0021994ba4746 (diff)
don't crash out of the controller heartbeat loop here
Diffstat (limited to 'controller/PostgreSQL.cpp')
-rw-r--r--controller/PostgreSQL.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/controller/PostgreSQL.cpp b/controller/PostgreSQL.cpp
index 28418ec3..ffe9b0f1 100644
--- a/controller/PostgreSQL.cpp
+++ b/controller/PostgreSQL.cpp
@@ -1014,12 +1014,16 @@ void PostgreSQL::heartbeat()
}
_pool->unborrow(c);
- if (_redisMemberStatus) {
- if (_rc->clusterMode) {
- _cluster->zadd("controllers", "controllerId", ts);
- } else {
- _redis->zadd("controllers", "controllerId", ts);
+ try {
+ if (_redisMemberStatus) {
+ if (_rc->clusterMode) {
+ _cluster->zadd("controllers", "controllerId", ts);
+ } else {
+ _redis->zadd("controllers", "controllerId", ts);
+ }
}
+ } catch (sw::redis::Error &e) {
+ fprintf(stderr, "ERROR: Redis error in heartbeat thread: %s\n", e.what());
}
std::this_thread::sleep_for(std::chrono::milliseconds(1000));