DatabaseThread optimized
This commit is contained in:
		
							parent
							
								
									82d7967c04
								
							
						
					
					
						commit
						0089a6d7f6
					
				
					 2 changed files with 15 additions and 11 deletions
				
			
		|  | @ -33,6 +33,7 @@ | ||||||
| DatabaseThread::DatabaseThread(CrewDatabase *crewDB, QObject *parent) : QThread(parent), crewDB(crewDB) | DatabaseThread::DatabaseThread(CrewDatabase *crewDB, QObject *parent) : QThread(parent), crewDB(crewDB) | ||||||
| { | { | ||||||
|     crewMaxPages = 83; |     crewMaxPages = 83; | ||||||
|  |     threadRunning = true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void DatabaseThread::run() | void DatabaseThread::run() | ||||||
|  | @ -52,11 +53,13 @@ void DatabaseThread::run() | ||||||
|         emit playerNameUpdated(); |         emit playerNameUpdated(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     QEventLoop waitingLoop; |     QEventLoop *waitingLoop = new QEventLoop(); | ||||||
|     QTimer::singleShot(10000, &waitingLoop, SLOT(quit())); |     QTimer::singleShot(10000, waitingLoop, SLOT(quit())); | ||||||
|     waitingLoop.exec(); |     waitingLoop->exec(); | ||||||
|  |     delete waitingLoop; | ||||||
| 
 | 
 | ||||||
| dbtBegin: |     while (threadRunning) | ||||||
|  |     { | ||||||
|         crewList = crewDB->getCrews(); |         crewList = crewDB->getCrews(); | ||||||
| 
 | 
 | ||||||
|         // Long time scan
 |         // Long time scan
 | ||||||
|  | @ -65,7 +68,7 @@ dbtBegin: | ||||||
| 
 | 
 | ||||||
|         QTimer::singleShot(300000, &threadLoop, SLOT(quit())); |         QTimer::singleShot(300000, &threadLoop, SLOT(quit())); | ||||||
|         threadLoop.exec(); |         threadLoop.exec(); | ||||||
|     goto dbtBegin; |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void DatabaseThread::scanCrewMembersList(QStringList crewList, int maxPages, int requestDelay) | void DatabaseThread::scanCrewMembersList(QStringList crewList, int maxPages, int requestDelay) | ||||||
|  |  | ||||||
|  | @ -32,6 +32,7 @@ public: | ||||||
| private: | private: | ||||||
|     CrewDatabase *crewDB; |     CrewDatabase *crewDB; | ||||||
|     void scanCrewMembersList(QStringList crewList, int maxPages, int requestDelay); |     void scanCrewMembersList(QStringList crewList, int maxPages, int requestDelay); | ||||||
|  |     bool threadRunning; | ||||||
|     int crewMaxPages; |     int crewMaxPages; | ||||||
|     int plyrPerReq; |     int plyrPerReq; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue