mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
Merge pull request #4903 from nextcloud/bugfix/selective-sync-abort-error
Bugfix/selective sync abort error
This commit is contained in:
commit
926256df97
7 changed files with 26 additions and 7 deletions
|
@ -643,6 +643,12 @@ void FolderMan::scheduleFolder(Folder *f)
|
||||||
startScheduledSyncSoon();
|
startScheduledSyncSoon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FolderMan::scheduleFolderForImmediateSync(Folder *f)
|
||||||
|
{
|
||||||
|
_nextSyncShouldStartImmediately = true;
|
||||||
|
scheduleFolder(f);
|
||||||
|
}
|
||||||
|
|
||||||
void FolderMan::scheduleFolderNext(Folder *f)
|
void FolderMan::scheduleFolderNext(Folder *f)
|
||||||
{
|
{
|
||||||
auto alias = f->alias();
|
auto alias = f->alias();
|
||||||
|
@ -792,6 +798,12 @@ void FolderMan::startScheduledSyncSoon()
|
||||||
// Time since the last sync run counts against the delay
|
// Time since the last sync run counts against the delay
|
||||||
msDelay = qMax(1ll, msDelay - msSinceLastSync);
|
msDelay = qMax(1ll, msDelay - msSinceLastSync);
|
||||||
|
|
||||||
|
if (_nextSyncShouldStartImmediately) {
|
||||||
|
_nextSyncShouldStartImmediately = false;
|
||||||
|
qCInfo(lcFolderMan) << "Next sync is marked to start immediately, so setting the delay to '0'";
|
||||||
|
msDelay = 0;
|
||||||
|
}
|
||||||
|
|
||||||
qCInfo(lcFolderMan) << "Starting the next scheduled sync in" << (msDelay / 1000) << "seconds";
|
qCInfo(lcFolderMan) << "Starting the next scheduled sync in" << (msDelay / 1000) << "seconds";
|
||||||
_startScheduledSyncTimer.start(msDelay);
|
_startScheduledSyncTimer.start(msDelay);
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,6 +193,9 @@ public:
|
||||||
/** Queues a folder for syncing. */
|
/** Queues a folder for syncing. */
|
||||||
void scheduleFolder(Folder *);
|
void scheduleFolder(Folder *);
|
||||||
|
|
||||||
|
/** Queues a folder for syncing that starts immediately. */
|
||||||
|
void scheduleFolderForImmediateSync(Folder *);
|
||||||
|
|
||||||
/** Puts a folder in the very front of the queue. */
|
/** Puts a folder in the very front of the queue. */
|
||||||
void scheduleFolderNext(Folder *);
|
void scheduleFolderNext(Folder *);
|
||||||
|
|
||||||
|
@ -357,6 +360,8 @@ private:
|
||||||
/// Picks the next scheduled folder and starts the sync
|
/// Picks the next scheduled folder and starts the sync
|
||||||
QTimer _startScheduledSyncTimer;
|
QTimer _startScheduledSyncTimer;
|
||||||
|
|
||||||
|
bool _nextSyncShouldStartImmediately = false;
|
||||||
|
|
||||||
QScopedPointer<SocketApi> _socketApi;
|
QScopedPointer<SocketApi> _socketApi;
|
||||||
NavigationPaneHelper _navigationPaneHelper;
|
NavigationPaneHelper _navigationPaneHelper;
|
||||||
|
|
||||||
|
|
|
@ -931,7 +931,7 @@ void FolderStatusModel::slotApplySelectiveSync()
|
||||||
folder->journalDb()->schedulePathForRemoteDiscovery(it);
|
folder->journalDb()->schedulePathForRemoteDiscovery(it);
|
||||||
folder->schedulePathForLocalDiscovery(it);
|
folder->schedulePathForLocalDiscovery(it);
|
||||||
}
|
}
|
||||||
FolderMan::instance()->scheduleFolder(folder);
|
FolderMan::instance()->scheduleFolderForImmediateSync(folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -544,7 +544,7 @@ void SelectiveSyncDialog::accept()
|
||||||
_folder->schedulePathForLocalDiscovery(it);
|
_folder->schedulePathForLocalDiscovery(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
folderMan->scheduleFolder(_folder);
|
folderMan->scheduleFolderForImmediateSync(_folder);
|
||||||
}
|
}
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -482,6 +482,8 @@ void OwncloudPropagator::start(SyncFileItemVector &&items)
|
||||||
{
|
{
|
||||||
Q_ASSERT(std::is_sorted(items.begin(), items.end()));
|
Q_ASSERT(std::is_sorted(items.begin(), items.end()));
|
||||||
|
|
||||||
|
_abortRequested = false;
|
||||||
|
|
||||||
/* This builds all the jobs needed for the propagation.
|
/* This builds all the jobs needed for the propagation.
|
||||||
* Each directory is a PropagateDirectory job, which contains the files in it.
|
* Each directory is a PropagateDirectory job, which contains the files in it.
|
||||||
* In order to do that we loop over the items. (which are sorted by destination)
|
* In order to do that we loop over the items. (which are sorted by destination)
|
||||||
|
|
|
@ -538,6 +538,8 @@ public:
|
||||||
{
|
{
|
||||||
if (_abortRequested)
|
if (_abortRequested)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
_abortRequested = true;
|
||||||
if (_rootJob) {
|
if (_rootJob) {
|
||||||
// Connect to abortFinished which signals that abort has been asynchronously finished
|
// Connect to abortFinished which signals that abort has been asynchronously finished
|
||||||
connect(_rootJob.data(), &PropagateDirectory::abortFinished, this, &OwncloudPropagator::emitFinished);
|
connect(_rootJob.data(), &PropagateDirectory::abortFinished, this, &OwncloudPropagator::emitFinished);
|
||||||
|
@ -633,6 +635,7 @@ private slots:
|
||||||
{
|
{
|
||||||
if (!_finishedEmited)
|
if (!_finishedEmited)
|
||||||
emit finished(status == SyncFileItem::Success);
|
emit finished(status == SyncFileItem::Success);
|
||||||
|
_abortRequested = false;
|
||||||
_finishedEmited = true;
|
_finishedEmited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1056,19 +1056,16 @@ void SyncEngine::switchToVirtualFiles(const QString &localPath, SyncJournalDb &j
|
||||||
|
|
||||||
void SyncEngine::abort()
|
void SyncEngine::abort()
|
||||||
{
|
{
|
||||||
if (_propagator)
|
|
||||||
qCInfo(lcEngine) << "Aborting sync";
|
|
||||||
|
|
||||||
if (_propagator) {
|
if (_propagator) {
|
||||||
// If we're already in the propagation phase, aborting that is sufficient
|
// If we're already in the propagation phase, aborting that is sufficient
|
||||||
|
qCInfo(lcEngine) << "Aborting sync in propagator...";
|
||||||
_propagator->abort();
|
_propagator->abort();
|
||||||
} else if (_discoveryPhase) {
|
} else if (_discoveryPhase) {
|
||||||
// Delete the discovery and all child jobs after ensuring
|
// Delete the discovery and all child jobs after ensuring
|
||||||
// it can't finish and start the propagator
|
// it can't finish and start the propagator
|
||||||
disconnect(_discoveryPhase.data(), nullptr, this, nullptr);
|
disconnect(_discoveryPhase.data(), nullptr, this, nullptr);
|
||||||
_discoveryPhase.take()->deleteLater();
|
_discoveryPhase.take()->deleteLater();
|
||||||
|
qCInfo(lcEngine) << "Aborting sync in discovery...";
|
||||||
Q_EMIT syncError(tr("Synchronization will resume shortly."));
|
|
||||||
finalize(false);
|
finalize(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue