Skip to content

Commit cf594b7

Browse files
authored
Always stop reconnect timer in cluster (#517)
It needs to be explicitly stopped so that the timer handle is cleaned up before the event loop is closed.
1 parent 5a91c62 commit cf594b7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/cluster.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,10 @@ void Cluster::on_reconnect(ControlConnector* connector) {
454454

455455
void Cluster::internal_close() {
456456
is_closing_ = true;
457+
bool was_timer_running = timer_.is_running();
458+
timer_.stop();
457459
monitor_reporting_timer_.stop();
458-
if (timer_.is_running()) {
459-
timer_.stop();
460+
if (was_timer_running) {
460461
handle_close();
461462
} else if (reconnector_) {
462463
reconnector_->cancel();

0 commit comments

Comments
 (0)