Bug 1419990 - Only sync the tabs collection on sleep if there are changes. r=markh
authorEdouard Oger <eoger@fastmail.com>
Thu, 23 Nov 2017 11:24:41 -0500
changeset 438055 f3cbe894d2f20d98cfd8338a28f4a1413a2ce77e
parent 438054 b0e41c10f60ca92929d9390283a755c6d10598d6
child 438056 88f353b08c571d71eac3f3c0b024b54fb677cefc
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
reviewersmarkh
bugs1419990
milestone59.0a1
Bug 1419990 - Only sync the tabs collection on sleep if there are changes. r=markh MozReview-Commit-ID: GC0KMmQPqqD
services/sync/modules/policies.js
--- a/services/sync/modules/policies.js
+++ b/services/sync/modules/policies.js
@@ -387,18 +387,20 @@ SyncScheduler.prototype = {
         break;
       case "captive-portal-login-success":
         this.shouldSyncWhenLinkComesUp = false;
         this._log.debug("Captive portal login success. Scheduling a sync.");
         CommonUtils.nextTick(() => {
           this.scheduleNextSync(3000);
         });
       case "sleep_notification":
-        this._log.debug("Going to sleep, doing a quick sync.");
-        this.scheduleNextSync(0, ["tabs"], "sleep");
+        if (this.service.engineManager.get("tabs")._tracker.modified) {
+          this._log.debug("Going to sleep, doing a quick sync.");
+          this.scheduleNextSync(0, ["tabs"], "sleep");
+        }
         break;
     }
   },
 
   adjustSyncInterval: function adjustSyncInterval() {
     if (Status.eol) {
       this._log.debug("Server status is EOL; using eolInterval.");
       this.syncInterval = this.eolInterval;