diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index d6d8a3a02ac4c..97625c5c64a0b 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -645,9 +645,13 @@ void Folder::startSync(const QStringList &pathList) } return interval; }(); - if (_folderWatcher && _folderWatcher->isReliable() && _timeSinceLastFullLocalDiscovery.isValid() - && (fullLocalDiscoveryInterval.count() < 0 - || _timeSinceLastFullLocalDiscovery.hasExpired(fullLocalDiscoveryInterval.count()))) { + bool hasDoneFullLocalDiscovery = _timeSinceLastFullLocalDiscovery.isValid(); + bool periodicFullLocalDiscoveryNow = + fullLocalDiscoveryInterval.count() >= 0 // negative means we don't require periodic full runs + && _timeSinceLastFullLocalDiscovery.hasExpired(fullLocalDiscoveryInterval.count()); + if (_folderWatcher && _folderWatcher->isReliable() + && hasDoneFullLocalDiscovery + && !periodicFullLocalDiscoveryNow) { qCInfo(lcFolder) << "Allowing local discovery to read from the database"; _engine->setLocalDiscoveryOptions(LocalDiscoveryStyle::DatabaseAndFilesystem, _localDiscoveryPaths);