From bb2e492d259fc78d015c65f2d94bedcd21779538 Mon Sep 17 00:00:00 2001 From: Edward Lee Date: Fri, 25 Sep 2009 17:32:35 -0700 Subject: [PATCH] Use the default or backoff intervals only after checking a previously scheduled sync and pick the bigger of the two. --- services/sync/modules/service.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js index 72b1f762b711..ef294e5eeaac 100644 --- a/services/sync/modules/service.js +++ b/services/sync/modules/service.js @@ -1027,15 +1027,12 @@ WeaveSvc.prototype = { _scheduleNextSync: function WeaveSvc__scheduleNextSync(interval) { // Figure out when to sync next if not given a interval to wait if (interval == null) { - // Make sure we backoff we we need to - if (this.status.backoffInterval != 0) - interval = this.status.backoffInterval; // Check if we had a pending sync from last time - else if (this.nextSync != 0) + if (this.nextSync != 0) interval = this.nextSync - Date.now(); - // Use the default sync interval + // Use the bigger of default sync interval and backoff else - interval = this.syncInterval; + interval = Math.max(this.syncInterval, this.status.backoffInterval); } // Start the sync right away if we're already late