author | Richard Newman <rnewman@mozilla.com> |
Sat, 22 Dec 2012 11:43:56 -0800 | |
changeset 117367 | bd2ac0175972d697750398f4b0600ae93789f3ae |
parent 117366 | 2058a54f318015cb657a9b8389be0b59f3d7524e |
child 117368 | b29575b9f9dd0c8859fe68d88ebabd88c6da2e13 |
push id | 24098 |
push user | rnewman@mozilla.com |
push date | Thu, 03 Jan 2013 03:39:06 +0000 |
treeherder | mozilla-central@6955309291ee [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | gps |
bugs | 699546 |
milestone | 20.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
services/sync/modules/policies.js | file | annotate | diff | comparison | revisions | |
services/sync/modules/resource.js | file | annotate | diff | comparison | revisions |
--- a/services/sync/modules/policies.js +++ b/services/sync/modules/policies.js @@ -168,20 +168,22 @@ SyncScheduler.prototype = { // should still be updated so that the next sync has a correct interval. this.updateClientMode(); this.adjustSyncInterval(); this.nextSync = 0; this.handleSyncError(); break; case "weave:service:backoff:interval": let requested_interval = subject * 1000; + this._log.debug("Got backoff notification: " + requested_interval + "ms"); // Leave up to 25% more time for the back off. let interval = requested_interval * (1 + Math.random() * 0.25); Status.backoffInterval = interval; Status.minimumNextSync = Date.now() + requested_interval; + this._log.debug("Fuzzed minimum next sync: " + Status.minimumNextSync); break; case "weave:service:ready": // Applications can specify this preference if they want autoconnect // to happen after a fixed delay. let delay = Svc.Prefs.get("autoconnectDelay"); if (delay) { this.delayedAutoConnect(delay); } @@ -800,23 +802,25 @@ ErrorHandler.prototype = { break; case 500: case 502: case 503: case 504: Status.enforceBackoff = true; if (resp.status == 503 && resp.headers["retry-after"]) { + let retryAfter = resp.headers["retry-after"]; + this._log.debug("Got Retry-After: " + retryAfter); if (this.service.isLoggedIn) { Status.sync = SERVER_MAINTENANCE; } else { Status.login = SERVER_MAINTENANCE; } Svc.Obs.notify("weave:service:backoff:interval", - parseInt(resp.headers["retry-after"], 10)); + parseInt(retryAfter, 10)); } break; } switch (resp.result) { case Cr.NS_ERROR_UNKNOWN_HOST: case Cr.NS_ERROR_CONNECTION_REFUSED: case Cr.NS_ERROR_NET_TIMEOUT:
--- a/services/sync/modules/resource.js +++ b/services/sync/modules/resource.js @@ -280,23 +280,27 @@ AsyncResource.prototype = { channel.visitResponseHeaders({ visitHeader: function visitHeader(header, value) { headers[header.toLowerCase()] = value; } }); // This is a server-side safety valve to allow slowing down // clients without hurting performance. - if (headers["x-weave-backoff"]) + if (headers["x-weave-backoff"]) { + let backoff = headers["x-weave-backoff"]; + this._log.debug("Got X-Weave-Backoff: " + backoff); Observers.notify("weave:service:backoff:interval", - parseInt(headers["x-weave-backoff"], 10)); + parseInt(backoff, 10)); + } - if (success && headers["x-weave-quota-remaining"]) + if (success && headers["x-weave-quota-remaining"]) { Observers.notify("weave:service:quota:remaining", parseInt(headers["x-weave-quota-remaining"], 10)); + } } catch (ex) { this._log.debug("Caught exception " + CommonUtils.exceptionStr(ex) + " visiting headers in _onComplete."); this._log.debug(CommonUtils.stackTrace(ex)); } let ret = new String(data); ret.status = status;