Index: autotests/server/collectionschedulertest.cpp =================================================================== --- autotests/server/collectionschedulertest.cpp +++ autotests/server/collectionschedulertest.cpp @@ -52,7 +52,7 @@ // Collections root (1), ColA (2), ColB (3), ColD (5), virtual (6) and virtual2 (7) // should have a check scheduled in 5 minutes (default value) for (qint64 collectionId : {1, 2, 3, 5, 6, 7}) { - QVERIFY(sched.nextScheduledTime(collectionId) > now + 4min); + QVERIFY2(sched.nextScheduledTime(collectionId) > now + 4min, qPrintable(QString::number(collectionId))); QVERIFY(sched.nextScheduledTime(collectionId) < now + 6min); } QCOMPARE(sched.nextScheduledTime(4).time_since_epoch(), TimePoint::duration::zero()); // ColC is skipped because syncPref=false Index: autotests/server/fakecollectionscheduler.h =================================================================== --- autotests/server/fakecollectionscheduler.h +++ autotests/server/fakecollectionscheduler.h @@ -37,7 +37,7 @@ protected: void init() override; - bool shouldScheduleCollection(const Collection &) override { return true; } + bool shouldScheduleCollection(const Collection &) override; bool hasChanged(const Collection &collection, const Collection &changed) override; int collectionScheduleInterval(const Collection &collection) override; void collectionExpired(const Collection &collection) override; Index: autotests/server/fakecollectionscheduler.cpp =================================================================== --- autotests/server/fakecollectionscheduler.cpp +++ autotests/server/fakecollectionscheduler.cpp @@ -37,6 +37,11 @@ m_initCalled.release(); } +bool FakeCollectionScheduler::shouldScheduleCollection(const Collection &collection) +{ + return (collection.syncPref() == Collection::True) || ((collection.syncPref() == Collection::Undefined) && collection.enabled()); +} + bool FakeCollectionScheduler::hasChanged(const Collection &collection, const Collection &changed) { Q_ASSERT(collection.id() == changed.id()); Index: src/server/collectionscheduler.cpp =================================================================== --- src/server/collectionscheduler.cpp +++ src/server/collectionscheduler.cpp @@ -302,14 +302,6 @@ // Only retrieve enabled collections and referenced collections, we don't care // about anything else SelectQueryBuilder qb; - Query::Condition orCondition(Query::Or); - orCondition.addValueCondition(Collection::syncPrefFullColumnName(), Query::Equals, (int)Akonadi::Tristate::True); - Query::Condition andCondition(Query::And); - andCondition.addValueCondition(Collection::syncPrefFullColumnName(), Query::Equals, (int)Akonadi::Tristate::Undefined); - andCondition.addValueCondition(Collection::enabledFullColumnName(), Query::Equals, true); - orCondition.addCondition(andCondition); - orCondition.addValueCondition(Collection::referencedFullColumnName(), Query::Equals, true); - qb.addCondition(orCondition); if (!qb.exec()) { qCWarning(AKONADISERVER_LOG) << "Failed to query initial collections for scheduler!"; qCWarning(AKONADISERVER_LOG) << "Not a fatal error, no collections will be scheduled for sync or cache expiration!";