diff --git a/server/src/intervalcheck.cpp b/server/src/intervalcheck.cpp --- a/server/src/intervalcheck.cpp +++ b/server/src/intervalcheck.cpp @@ -72,7 +72,7 @@ const int interval = qMax( MINIMUM_COLTREESYNC_INTERVAL, collection.cachePolicyCheckInterval() ); const QDateTime lastExpectedCheck = now.addSecs( interval * -60 ); - if ( !mLastCollectionTreeSyncs.contains( resourceName ) || mLastCollectionTreeSyncs.value( resourceName ) < lastExpectedCheck ) { + if ( !mLastCollectionTreeSyncs.contains( resourceName ) || mLastCollectionTreeSyncs.value( resourceName ) < lastExpectedCheck.addSecs( 2 * -60 ) ) { mLastCollectionTreeSyncs.insert( resourceName, now ); QMetaObject::invokeMethod( ItemRetrievalManager::instance(), "triggerCollectionTreeSync", Qt::QueuedConnection, @@ -84,7 +84,9 @@ const int interval = qMax( MINIMUM_AUTOSYNC_INTERVAL, collection.cachePolicyCheckInterval() ); const QDateTime lastExpectedCheck = now.addSecs( interval * -60 ); - if ( mLastChecks.contains( collection.id() ) && mLastChecks.value( collection.id() ) > lastExpectedCheck ) { + //For an interval of 5min, we don't resync if we already did a sync within the last three minutes. + //Doing an exact check is too error prone, and can lead to not syncing for up to 2*interval()-1. + if ( mLastChecks.contains( collection.id() ) && mLastChecks.value( collection.id() ) > lastExpectedCheck.addSecs( 2 * -60 ) ) { return; } mLastChecks.insert( collection.id(), now );