[Pkg-owncloud-commits] [owncloud-client] 06/211: Sync scheduling: Don't always force-sync. #2268

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 25 09:10:20 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 285cb78962d2d62ebba7f0af05691f1e8eed11f4
Author: Christian Kamm <kamm at incasoftware.de>
Date:   Wed Oct 8 10:41:03 2014 +0200

    Sync scheduling: Don't always force-sync. #2268
    
    If lastEtag was null, a force sync was triggered. Force syncs
    don't update the etag. The etag retrieval job would only run if
    lastEtag was not null. So it could never become non-null.
---
 src/mirall/folder.cpp | 12 +++++++-----
 src/mirall/folder.h   |  1 +
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/mirall/folder.cpp b/src/mirall/folder.cpp
index 4efd2d5..5c5cdc1 100644
--- a/src/mirall/folder.cpp
+++ b/src/mirall/folder.cpp
@@ -60,6 +60,7 @@ Folder::Folder(const QString &alias, const QString &path, const QString& secondP
       , _csyncUnavail(false)
       , _wipeDb(false)
       , _proxyDirty(true)
+      , _forceSyncOnPollTimeout(false)
       , _journal(path)
       , _csync_ctx(0)
 {
@@ -270,9 +271,10 @@ void Folder::slotPollTimerTimeout()
     }
 
     if (quint64(_timeSinceLastSync.elapsed()) > MirallConfigFile().forceSyncInterval() ||
-            _lastEtag.isNull() ||
+            _forceSyncOnPollTimeout ||
             !(_syncResult.status() == SyncResult::Success ||_syncResult.status() == SyncResult::Problem)) {
         qDebug() << "** Force Sync now, state is " << _syncResult.statusString();
+        _forceSyncOnPollTimeout = false;
         emit scheduleToSync(alias());
     } else {
         // do the ordinary etag check for the root folder.
@@ -731,9 +733,8 @@ void Folder::slotSyncFinished()
         _pollTimer.start();
         _timeSinceLastSync.restart();
     } else {
-        // Another sync is required.  We will make sure that the poll timer occurs soon enough
-        // and we clear the etag to force a sync
-        _lastEtag.clear();
+        // Another sync is required.  We will make sure that the poll timer occurs soon enough.
+        _forceSyncOnPollTimeout = true;
         QTimer::singleShot(1000, this, SLOT(slotPollTimerTimeout() ));
     }
 
@@ -799,7 +800,8 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *cancel)
     if (*cancel) {
         wipe();
         // speed up next sync
-        _lastEtag = QString();
+        _lastEtag.clear();
+        _forceSyncOnPollTimeout = true;
         QTimer::singleShot(50, this, SLOT(slotPollTimerTimeout()));
     }
 }
diff --git a/src/mirall/folder.h b/src/mirall/folder.h
index 99988e7..af96511 100644
--- a/src/mirall/folder.h
+++ b/src/mirall/folder.h
@@ -202,6 +202,7 @@ private:
     QTimer        _pollTimer;
     QString       _lastEtag;
     QElapsedTimer _timeSinceLastSync;
+    bool          _forceSyncOnPollTimeout;
 
     SyncJournalDb _journal;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list