shared: indexer: Don't dispatch DirScanner if no dirs given
This makes sense in general, however it also avoids a race condition. The dirscanner may finish before the filescanworkers for the files run, this then signals the whole indexer has finished.
This commit is contained in:
parent
52b296ff01
commit
0e5abf96c8
@ -36,10 +36,14 @@ void Indexer::beginIndexing()
|
|||||||
this->filePathTargetsQueue.enqueue(path);
|
this->filePathTargetsQueue.enqueue(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->dirScanner->setPaths(dirs);
|
|
||||||
this->dirScanner->setIgnorePatterns(this->ignorePattern);
|
|
||||||
|
|
||||||
this->dirScanner->scan();
|
if(!dirs.empty())
|
||||||
|
{
|
||||||
|
this->dirScanner->setPaths(dirs);
|
||||||
|
this->dirScanner->setIgnorePatterns(this->ignorePattern);
|
||||||
|
|
||||||
|
this->dirScanner->scan();
|
||||||
|
}
|
||||||
|
|
||||||
this->workerCancellationToken.store(false, std::memory_order_seq_cst);
|
this->workerCancellationToken.store(false, std::memory_order_seq_cst);
|
||||||
launchWorker(this->filePathTargetsQueue, this->filePathTargetsQueue.remaining());
|
launchWorker(this->filePathTargetsQueue, this->filePathTargetsQueue.remaining());
|
||||||
@ -68,7 +72,7 @@ IndexResult Indexer::getResult()
|
|||||||
|
|
||||||
void Indexer::dirScanFinished()
|
void Indexer::dirScanFinished()
|
||||||
{
|
{
|
||||||
Logger::info() << "Dir scan finished";
|
Logger::info() << "Dir scan finished" << Qt::endl;
|
||||||
if(!isRunning())
|
if(!isRunning())
|
||||||
{
|
{
|
||||||
emit finished();
|
emit finished();
|
||||||
|
Loading…
Reference in New Issue
Block a user