diff options
| author | Grant Limberg <[email protected]> | 2022-06-30 11:40:04 -0700 |
|---|---|---|
| committer | Grant Limberg <[email protected]> | 2022-06-30 11:40:04 -0700 |
| commit | 9cf8dacfbbab6b9663ba279b8de0a6d3f99a6a4e (patch) | |
| tree | 749b4b6cf299b325af9d995688cfa2c2f01be3c4 /controller/PostgreSQL.cpp | |
| parent | b5d7d71e1e78fd34e6976e210bf0021994ba4746 (diff) | |
don't crash out of the controller heartbeat loop here
Diffstat (limited to 'controller/PostgreSQL.cpp')
| -rw-r--r-- | controller/PostgreSQL.cpp | 14 |
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)); |
