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)
|
||||
{
|
||||
crewMaxPages = 83;
|
||||
threadRunning = true;
|
||||
}
|
||||
|
||||
void DatabaseThread::run()
|
||||
|
@ -52,11 +53,13 @@ void DatabaseThread::run()
|
|||
emit playerNameUpdated();
|
||||
}
|
||||
|
||||
QEventLoop waitingLoop;
|
||||
QTimer::singleShot(10000, &waitingLoop, SLOT(quit()));
|
||||
waitingLoop.exec();
|
||||
QEventLoop *waitingLoop = new QEventLoop();
|
||||
QTimer::singleShot(10000, waitingLoop, SLOT(quit()));
|
||||
waitingLoop->exec();
|
||||
delete waitingLoop;
|
||||
|
||||
dbtBegin:
|
||||
while (threadRunning)
|
||||
{
|
||||
crewList = crewDB->getCrews();
|
||||
|
||||
// Long time scan
|
||||
|
@ -65,7 +68,7 @@ dbtBegin:
|
|||
|
||||
QTimer::singleShot(300000, &threadLoop, SLOT(quit()));
|
||||
threadLoop.exec();
|
||||
goto dbtBegin;
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseThread::scanCrewMembersList(QStringList crewList, int maxPages, int requestDelay)
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
private:
|
||||
CrewDatabase *crewDB;
|
||||
void scanCrewMembersList(QStringList crewList, int maxPages, int requestDelay);
|
||||
bool threadRunning;
|
||||
int crewMaxPages;
|
||||
int plyrPerReq;
|
||||
|
||||
|
|
Loading…
Reference in a new issue