[Pkg-owncloud-commits] [owncloud-client] 199/211: Sync scheduling: Only retry up to twice after fail. #2386
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Oct 25 09:10:45 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 82b14370fc35e689f9b0bb7a61323831693bf6be
Author: Christian Kamm <kamm at incasoftware.de>
Date: Fri Oct 24 10:57:16 2014 +0200
Sync scheduling: Only retry up to twice after fail. #2386
Previously when a sync failed, we'd retry very soon (30s) no matter how
often a sync had failed before. After this change we'll retry twice and
then back off to the regular 5min interval.
---
src/mirall/folder.cpp | 25 +++++++++++++++++++------
src/mirall/folder.h | 1 +
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/src/mirall/folder.cpp b/src/mirall/folder.cpp
index 041cda1..f2f1cfe 100644
--- a/src/mirall/folder.cpp
+++ b/src/mirall/folder.cpp
@@ -61,6 +61,7 @@ Folder::Folder(const QString &alias, const QString &path, const QString& secondP
, _wipeDb(false)
, _proxyDirty(true)
, _forceSyncOnPollTimeout(false)
+ , _consecutiveFailingSyncs(0)
, _journal(path)
, _csync_ctx(0)
{
@@ -272,12 +273,10 @@ void Folder::slotPollTimerTimeout()
bool forceSyncIntervalExpired =
quint64(_timeSinceLastSync.elapsed()) > MirallConfigFile().forceSyncInterval();
- bool okSyncResult =
- _syncResult.status() == SyncResult::Success ||
- _syncResult.status() == SyncResult::Problem;
+ bool syncAgainAfterFail = _consecutiveFailingSyncs > 0 && _consecutiveFailingSyncs < 3;
if (forceSyncIntervalExpired ||
_forceSyncOnPollTimeout ||
- !okSyncResult) {
+ syncAgainAfterFail) {
if (forceSyncIntervalExpired) {
qDebug() << "** Force Sync, because it has been " << _timeSinceLastSync.elapsed() << "ms "
<< "since the last sync";
@@ -285,8 +284,10 @@ void Folder::slotPollTimerTimeout()
if (_forceSyncOnPollTimeout) {
qDebug() << "** Force Sync, because it was requested";
}
- if (!okSyncResult) {
- qDebug() << "** Force Sync, because the last sync had status: " << _syncResult.statusString();
+ if (syncAgainAfterFail) {
+ qDebug() << "** Force Sync, because the last"
+ << _consecutiveFailingSyncs << "syncs failed, last status:"
+ << _syncResult.statusString();
}
_forceSyncOnPollTimeout = false;
emit scheduleToSync(alias());
@@ -830,6 +831,18 @@ void Folder::slotSyncFinished()
_syncResult.setStatus(SyncResult::Success);
}
+ // Count the number of syncs that have failed in a row.
+ if (_syncResult.status() == SyncResult::Success
+ || _syncResult.status() == SyncResult::Problem)
+ {
+ _consecutiveFailingSyncs = 0;
+ }
+ else
+ {
+ _consecutiveFailingSyncs++;
+ qDebug() << "the last" << _consecutiveFailingSyncs << "syncs failed";
+ }
+
emit syncStateChange();
// The syncFinished result that is to be triggered here makes the folderman
diff --git a/src/mirall/folder.h b/src/mirall/folder.h
index b67e957..57ccdd7 100644
--- a/src/mirall/folder.h
+++ b/src/mirall/folder.h
@@ -203,6 +203,7 @@ private:
QString _lastEtag;
QElapsedTimer _timeSinceLastSync;
bool _forceSyncOnPollTimeout;
+ int _consecutiveFailingSyncs;
// For the SocketAPI folder states
QSet<QString> _stateLastSyncItemsWithErrorNew; // gets moved to _stateLastSyncItemsWithError at end of sync
--
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