mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 21:46:03 +03:00
Finish danimo's patch that refactor the scheduler
Wait a full poll interval after the end of the sync
This commit is contained in:
parent
578bcc3522
commit
6fb5c04bde
3 changed files with 8 additions and 11 deletions
|
@ -83,6 +83,7 @@ Folder::Folder(const QString &alias, const QString &path, const QString& secondP
|
|||
|
||||
ServerActionNotifier *notifier = new ServerActionNotifier(this);
|
||||
connect(notifier, SIGNAL(guiLog(QString,QString)), Logger::instance(), SIGNAL(optionalGuiLog(QString,QString)));
|
||||
connect(this, SIGNAL(syncFinished(SyncResult)), this, SLOT(slotSyncFinished(SyncResult)));
|
||||
connect(this, SIGNAL(syncFinished(SyncResult)), notifier, SLOT(slotSyncFinished(SyncResult)));
|
||||
|
||||
// check if the local path exists
|
||||
|
@ -251,12 +252,6 @@ void Folder::slotChanged(const QStringList &pathList)
|
|||
evaluateSync(pathList);
|
||||
}
|
||||
|
||||
void Folder::slotSyncStarted()
|
||||
{
|
||||
// disable events until syncing is done
|
||||
_watcher->setEventsEnabled(false);
|
||||
}
|
||||
|
||||
void Folder::slotSyncFinished(const SyncResult &result)
|
||||
{
|
||||
_watcher->setEventsEnabledDelayed(2000);
|
||||
|
@ -543,6 +538,9 @@ void Folder::startSync(const QStringList &pathList)
|
|||
|
||||
_thread->start();
|
||||
QMetaObject::invokeMethod(_csync, "startSync", Qt::QueuedConnection);
|
||||
|
||||
// disable events until syncing is done
|
||||
_watcher->setEventsEnabled(false);
|
||||
emit syncStarted();
|
||||
}
|
||||
|
||||
|
|
|
@ -172,11 +172,6 @@ private slots:
|
|||
|
||||
void slotPollTimerTimeout();
|
||||
|
||||
|
||||
/** called when the watcher detect a list of changed paths */
|
||||
|
||||
void slotSyncStarted();
|
||||
|
||||
/**
|
||||
* Triggered by a file system watcher on the local sync dir
|
||||
*/
|
||||
|
|
|
@ -56,6 +56,7 @@ FolderMan::FolderMan(QObject *parent) :
|
|||
qDebug() << "setting remote poll timer interval to" << polltime << "msec";
|
||||
_pollTimer->setInterval( polltime );
|
||||
QObject::connect(_pollTimer, SIGNAL(timeout()), this, SLOT(slotScheduleAllFolders()));
|
||||
_pollTimer->setSingleShot(true);
|
||||
_pollTimer->start();
|
||||
}
|
||||
|
||||
|
@ -358,6 +359,7 @@ void FolderMan::slotScheduleSync( const QString& alias )
|
|||
} else {
|
||||
qDebug() << " II> Sync for folder " << alias << " already scheduled, do not enqueue!";
|
||||
}
|
||||
slotScheduleFolderSync();
|
||||
}
|
||||
|
||||
void FolderMan::setSyncEnabled( bool enabled )
|
||||
|
@ -391,6 +393,7 @@ void FolderMan::slotScheduleFolderSync()
|
|||
_currentSyncFolder = alias;
|
||||
if (f->syncEnabled()) {
|
||||
f->startSync( QStringList() );
|
||||
_pollTimer->stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -411,6 +414,7 @@ void FolderMan::slotFolderSyncFinished( const SyncResult& )
|
|||
|
||||
_currentSyncFolder.clear();
|
||||
QTimer::singleShot(200, this, SLOT(slotScheduleFolderSync()));
|
||||
_pollTimer->start();
|
||||
}
|
||||
|
||||
void FolderMan::addFolderDefinition(const QString& alias, const QString& sourceFolder, const QString& targetPath )
|
||||
|
|
Loading…
Reference in a new issue