Check if download/reporting thread are running

This commit is contained in:
Gerhard Hoffmann 2024-02-29 11:30:24 +01:00
parent 9b087f62f9
commit 052028afe8

View File

@ -655,9 +655,14 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
QThread::sleep(2);
if (!m_hw->dcDownloadRunning()) { // may take some time
int tries = 5;
while (!m_hw->dcDownloadRunning()) { // may take some time
if (--tries < 0) {
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD NOT RUNNING";
break;
}
QThread::sleep(1);
continue;
}
@ -666,9 +671,13 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
QThread::sleep(2);
if (!m_hw->dcDownloadReportThreadStart()) { // may take some time
tries = 5;
while (!m_hw->dcDownloadReportThreadStart()) { // may take some time
if (--tries < 0) {
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD NOT STARTED";
break;
}
continue;
}
@ -676,18 +685,29 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
<< "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD STARTED";
QThread::sleep(2);
if (!m_hw->dcDownloadReportRunning()) { // may take some time
tries = 5;
while (!m_hw->dcDownloadReportRunning()) { // may take some time
if (--tries < 0) {
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD REPORT NOT RUNNING";
break;
}
continue;
}
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD REPORT RUNNING";
tries = 1200;
while (m_hw->dcDownloadReportRunning()) {
QThread::msleep(500);
QThread::msleep(1000);
if (--tries < 0) {
qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "(" << __func__ << ":" << __LINE__
<< ") DOWNLOAD REPORT STILL RUNNING AFTER 20mins";
break;
}
}
bool updateBinaryRes = true;