bug 550597 - explicit server backoff is buggy, r=Mardak

--HG--
extra : rebase_source : 8e3621b0d7de77d918f1fe7ce1304f303fd19f97
This commit is contained in:
Mike Connor 2010-03-25 17:24:41 -04:00
parent a8a384a3b0
commit 777762c48e
2 changed files with 6 additions and 9 deletions

View File

@ -396,7 +396,7 @@ WeaveSvc.prototype = {
this._syncErrors = 0;
break;
case "weave:service:backoff:interval":
let interval = data + Math.random() * data * 0.25; // required backoff + up to 25%
let interval = (data + Math.random() * data * 0.25) * 1000; // required backoff + up to 25%
Status.backoffInterval = interval;
Status.minimumNextSync = Date.now() + data;
break;
@ -1175,6 +1175,10 @@ WeaveSvc.prototype = {
this._clearSyncTriggers();
this.nextSync = 0;
// reset backoff info, if the server tells us to continue backing off,
// we'll handle that later
Status.resetBackoff();
this.globalScore = 0;
if (!(this._remoteSetup()))
@ -1261,7 +1265,6 @@ WeaveSvc.prototype = {
this._log.debug("Client count: " + this.numClients + " -> " + numClients);
this.numClients = numClients;
let tabEngine = Engines.get("tabs");
if (numClients == 1) {
this.syncInterval = SINGLE_USER_SYNC;
this.syncThreshold = SINGLE_USER_THRESHOLD;

View File

@ -55,13 +55,7 @@ let Status = {
get sync() this._sync,
set sync(code) {
this._sync = code;
if (code != SYNC_SUCCEEDED)
this.service = SYNC_FAILED;
else {
this.service = STATUS_OK;
this.resetBackoff();
}
this.service = code == SYNC_SUCCEEDED ? STATUS_OK : SYNC_FAILED;
},
get engines() this._engines,