Check if download/reporting thread are running
This commit is contained in:
		
							
								
								
									
										30
									
								
								update.cpp
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								update.cpp
									
									
									
									
									
								
							@@ -655,9 +655,14 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            QThread::sleep(2);
 | 
					            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)
 | 
					                    qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
 | 
				
			||||||
                                << "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD NOT RUNNING";
 | 
					                                << "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD NOT RUNNING";
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                QThread::sleep(1);
 | 
				
			||||||
                continue;
 | 
					                continue;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -666,9 +671,13 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            QThread::sleep(2);
 | 
					            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)
 | 
					                    qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
 | 
				
			||||||
                                << "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD NOT STARTED";
 | 
					                                << "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD NOT STARTED";
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                continue;
 | 
					                continue;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -676,18 +685,29 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
 | 
				
			|||||||
                        << "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD STARTED";
 | 
					                        << "(" << __func__ << ":" << __LINE__ << ") REPORT THREAD STARTED";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            QThread::sleep(2);
 | 
					            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)
 | 
					                    qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
 | 
				
			||||||
                                << "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD REPORT NOT RUNNING";
 | 
					                                << "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD REPORT NOT RUNNING";
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                continue;
 | 
					                continue;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
 | 
					            qCritical() << QDateTime::currentDateTime().toString(Qt::ISODate)
 | 
				
			||||||
                        << "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD REPORT RUNNING";
 | 
					                        << "(" << __func__ << ":" << __LINE__ << ") DOWNLOAD REPORT RUNNING";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            tries = 1200;
 | 
				
			||||||
            while (m_hw->dcDownloadReportRunning()) {
 | 
					            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;
 | 
					            bool updateBinaryRes = true;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user