Skip to content

Commit

Permalink
Use proper addTimer call
Browse files Browse the repository at this point in the history
  • Loading branch information
dkulp committed Oct 19, 2023
1 parent e97e424 commit 4759fda
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,11 @@ void MosquittoClient::HandleConnect() {
}

void MosquittoClient::HandleDisconnect() {
LogWarn(VB_CONTROL, "Mosquitto Disconnected. Will try reconnect\n");
long long tm = GetTimeMS();
LogWarn(VB_CONTROL, "Mosquitto Disconnected. Will try reconnect %ld\n", tm);
m_isConnected = false;
Timers::INSTANCE.addTimer("MosquittoDisconnect", 15000, [this]() {
Timers::INSTANCE.addTimer("MosquittoDisconnect", tm + 10000, [this, tm]() {
if (!m_isConnected) {
LogWarn(VB_CONTROL, "Mosquitto Disconnected. Reconnect failed.\n");
WarningHolder::AddWarning("MQTT Disconnected");
}
});
Expand Down

0 comments on commit 4759fda

Please sign in to comment.