From 337bdd1bb08ceba1459ae16a419f255b31b8468e Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Fri, 18 Aug 2023 11:52:34 +0200 Subject: [PATCH] Add some debug output when restarting APISM. APISM is give a delay of 20s when restarting. --- worker.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/worker.cpp b/worker.cpp index 4c46673..cbf9dbd 100644 --- a/worker.cpp +++ b/worker.cpp @@ -506,10 +506,25 @@ bool Worker::updateTriggerSet() { emit appendText("\n" CHECK_UPDATE_TRIGGER_SET); QString triggerValue(""); + int const startMs = QTime::currentTime().msecsSinceStartOfDay(); - for (int repeat = 0; repeat < 100; ++repeat) { + for (int repeat = 1; repeat <= 100; ++repeat) { qInfo() << "UPDATE TRIGGER SET -> REPEAT" << repeat; + if (repeat > 1) { + int const durationMs = QTime::currentTime().msecsSinceStartOfDay() - startMs; + qInfo() << "REPEAT" << repeat + << QString("DURATION: %1.%2s").arg(durationMs / 1000).arg(durationMs % 1000); + } + if ((repeat % 10) == 0) { + qInfo() << "CHECK UPDATE TRIGGER. RESTART APISM ..."; + Command c("systemctl restart apism"); + if (c.execute("/tmp")) { + QThread::sleep(20); // give APISM some time to reconnect + qInfo() << "CHECK UPDATE TRIGGER. RESTARTING APISM DONE"; + } + } + startProgressLoop(); if (std::optional result = IsmasClient::sendRequestReceiveResponse(