diff options
author | Alon Albert <aalbert@google.com> | 2010-12-09 16:14:02 -0800 |
---|---|---|
committer | Alon Albert <aalbert@google.com> | 2010-12-14 10:09:54 -0800 |
commit | aeeb620906d037902d0c111a2272b6efd97f377a (patch) | |
tree | 38557f2b843031a706af263780237b50f557b9dd /core/java/android/content/SyncManager.java | |
parent | 0bd5243b751c9cad317758158f79b3347e7948af (diff) | |
download | frameworks_base-aeeb620906d037902d0c111a2272b6efd97f377a.zip frameworks_base-aeeb620906d037902d0c111a2272b6efd97f377a.tar.gz frameworks_base-aeeb620906d037902d0c111a2272b6efd97f377a.tar.bz2 |
Do not increase backoff before it expires
Change-Id: Ia5f382f3cc0b0d41bf382d98665dc50512513dda
Diffstat (limited to 'core/java/android/content/SyncManager.java')
-rw-r--r-- | core/java/android/content/SyncManager.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java index dde198e..e07dbb8 100644 --- a/core/java/android/content/SyncManager.java +++ b/core/java/android/content/SyncManager.java @@ -735,14 +735,24 @@ public class SyncManager implements OnAccountsUpdateListener { final Pair<Long, Long> previousSettings = mSyncStorageEngine.getBackoff(op.account, op.authority); - long newDelayInMs; - if (previousSettings == null || previousSettings.second <= 0) { + long newDelayInMs = -1; + if (previousSettings != null) { + // don't increase backoff before current backoff is expired. This will happen for op's + // with ignoreBackoff set. + if (now < previousSettings.first) { + if (Log.isLoggable(TAG, Log.VERBOSE)) { + Log.v(TAG, "Still in backoff, do not increase it. " + + "Remaining: " + ((previousSettings.first - now) / 1000) + " seconds."); + } + return; + } + // Subsequent delays are the double of the previous delay + newDelayInMs = previousSettings.second * 2; + } + if (newDelayInMs <= 0) { // The initial delay is the jitterized INITIAL_SYNC_RETRY_TIME_IN_MS newDelayInMs = jitterize(INITIAL_SYNC_RETRY_TIME_IN_MS, (long)(INITIAL_SYNC_RETRY_TIME_IN_MS * 1.1)); - } else { - // Subsequent delays are the double of the previous delay - newDelayInMs = previousSettings.second * 2; } // Cap the delay |