Skip to content

Commit 1797bc0

Browse files
committed
Init bridge reconnect timer from reloadTimers()
This fixes the bridge reconnect timer stopping when you change the save state interval or plugin periodic events and send a SIGHUP.
1 parent b62f01c commit 1797bc0

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

mainapp.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ void MainApp::sendBridgesToThreads()
382382
}
383383
}
384384

385-
void MainApp::queueBridgeReconnectAllThreads(bool alsoQueueNexts)
385+
void MainApp::queueBridgeReconnectAllThreads()
386386
{
387387
try
388388
{
@@ -396,12 +396,6 @@ void MainApp::queueBridgeReconnectAllThreads(bool alsoQueueNexts)
396396
Logger *logger = Logger::getInstance();
397397
logger->logf(LOG_ERR, ex.what());
398398
}
399-
400-
if (alsoQueueNexts)
401-
{
402-
auto fReconnectBridges = std::bind(&MainApp::queueBridgeReconnectAllThreads, this, false);
403-
timed_tasks.addTask(fReconnectBridges, 5000, true);
404-
}
405399
}
406400

407401
void MainApp::queueInternalHeartbeat()
@@ -670,7 +664,7 @@ void MainApp::start()
670664
}
671665

672666
sendBridgesToThreads();
673-
queueBridgeReconnectAllThreads(true);
667+
queueBridgeReconnectAllThreads();
674668

675669
std::minstd_rand randomish;
676670
randomish.seed(get_random_int<unsigned long>());
@@ -1100,7 +1094,7 @@ void MainApp::loadConfig(bool reload)
11001094
if (reload)
11011095
{
11021096
sendBridgesToThreads();
1103-
queueBridgeReconnectAllThreads(false);
1097+
queueBridgeReconnectAllThreads();
11041098
}
11051099
}
11061100

@@ -1225,6 +1219,15 @@ void MainApp::reloadTimers(bool reload, const Settings &old_settings)
12251219
auto fInternalHeartbeat = std::bind(&MainApp::queueInternalHeartbeat, this);
12261220
timed_tasks.addTask(fInternalHeartbeat, HEARTBEAT_INTERVAL, true);
12271221
}
1222+
1223+
{
1224+
uint32_t interval = 5000;
1225+
#ifdef TESTING
1226+
interval = 1000;
1227+
#endif
1228+
auto fReconnectBridges = std::bind(&MainApp::queueBridgeReconnectAllThreads, this);
1229+
timed_tasks.addTask(fReconnectBridges, interval, true);
1230+
}
12281231
}
12291232

12301233
/**

mainapp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class MainApp
9696
void waitForWillsQueued();
9797
void queueRetainedMessageExpiration();
9898
void sendBridgesToThreads();
99-
void queueBridgeReconnectAllThreads(bool alsoQueueNexts);
99+
void queueBridgeReconnectAllThreads();
100100
void queueInternalHeartbeat();
101101

102102
MainApp(const std::string &configFilePath);

0 commit comments

Comments
 (0)