repeat HTTP requests once

This commit is contained in:
John
2023-06-17 10:24:08 +02:00
parent 333ae3b82f
commit ea87515ef5
4 changed files with 58 additions and 15 deletions
+4 -2
View File
@@ -379,8 +379,10 @@ void MainLoop::run() {
m_busHandler->formatUpdateInfo(&ostr);
ostr << "}";
string response;
if (!m_httpClient.post("/", ostr.str(), &response)) {
bool repeat = false;
if (!m_httpClient.post("/", ostr.str(), &response, &repeat)) {
logError(lf_main, "update check error: %s", response.c_str());
nextCheckRun = now + (repeat ? CHECK_INITIAL_DELAY : CHECK_DELAY);
} else {
m_updateCheck = response.empty() ? "unknown" : response;
logNotice(lf_main, "update check: %s", response.c_str());
@@ -389,8 +391,8 @@ void MainLoop::run() {
dataSink->notifyUpdateCheckResult(response == "OK" ? "" : m_updateCheck);
}
}
nextCheckRun = now + CHECK_DELAY;
}
nextCheckRun = now + CHECK_DELAY;
}
}
time(&lastTaskRun);