Skip to content

Commit

Permalink
OSX: Trust the file watcher. owncloud#2297
Browse files Browse the repository at this point in the history
* Use a bigger default force sync interval (2h)
* Allow the file watcher to schedule a sync while a sync for
  the same file is running.
  • Loading branch information
ckamm committed Nov 20, 2014
1 parent f275002 commit d04eede
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/gui/folderman.cpp
Expand Up @@ -444,16 +444,19 @@ void FolderMan::slotScheduleSync( const QString& alias )
return;
}

#ifndef Q_OS_MAC
// The folder watcher fires a lot of bogus notifications during
// a sync operation, both for actual user files and the database
// and log. Never enqueue a folder for sync while it is syncing.
// We lose some genuine sync requests that way, but that can't be
// helped.
// ^^ FIXME: Note that this is not the case on OS X
// This works fine on OSX, where the folder watcher does not
// report changes done by our own process.
if( _currentSyncFolder == alias ) {
qDebug() << "folder " << alias << " is currently syncing. NOT scheduling.";
return;
}
#endif

if( _socketApi ) {
// We want the SocketAPI to already now update so that it can show the EVAL icon
Expand Down
9 changes: 8 additions & 1 deletion src/libsync/mirallconfigfile.cpp
Expand Up @@ -365,7 +365,14 @@ quint64 MirallConfigFile::forceSyncInterval(const QString& connection) const
QSettings settings(configFile(), QSettings::IniFormat);
settings.beginGroup( con );

quint64 interval = settings.value( QLatin1String(forceSyncIntervalC), 10 * pollInterval ).toULongLong();
quint64 defaultInterval = 10 * pollInterval;
#ifdef Q_OS_MAC
// On OSX we trust the file watcher. It does not report changes done
// by our own process and thus it's enabled during a folder's sync run.
// That means we don't need to do a full local discovery often.
defaultInterval = qMax(2 * 60 * 60 * 1000ull, defaultInterval); // >=2 hours
#endif
quint64 interval = settings.value( QLatin1String(forceSyncIntervalC), defaultInterval ).toULongLong();
if( interval < pollInterval) {
qDebug() << "Force sync interval is less than the remote poll inteval, reverting to" << pollInterval;
interval = pollInterval;
Expand Down

0 comments on commit d04eede

Please sign in to comment.