Bug 1273398 - Part 2: Modify listmanager to use RequestBackoffV4. r=francois.

This commit is contained in:
Henry Chang
2016-06-06 20:16:00 +02:00
parent cd4d5b1879
commit 9d94f1b868
2 changed files with 4 additions and 11 deletions

View File

@@ -114,18 +114,11 @@ PROT_ListManager.prototype.registerTable = function(tableName,
// Keep track of all of our update URLs.
if (!this.needsUpdate_[updateUrl]) {
this.needsUpdate_[updateUrl] = {};
/* Backoff interval should be between 30 and 60 minutes. */
var backoffInterval = 30 * 60 * 1000;
backoffInterval += Math.floor(Math.random() * (30 * 60 * 1000));
log("Creating request backoff for " + updateUrl);
this.requestBackoffs_[updateUrl] = new RequestBackoff(2 /* max errors */,
60*1000 /* retry interval, 1 min */,
// Using the V4 backoff algorithm for both V2 and V4. See bug 1273398.
this.requestBackoffs_[updateUrl] = new RequestBackoffV4(
4 /* num requests */,
60*60*1000 /* request time, 60 min */,
backoffInterval /* backoff interval, 60 min */,
8*60*60*1000 /* max backoff, 8hr */);
60*60*1000 /* request time, 60 min */);
}
this.needsUpdate_[updateUrl][tableName] = false;

View File

@@ -29,7 +29,7 @@ function Init() {
modScope.G_Alarm = jslib.G_Alarm;
modScope.BindToObject = jslib.BindToObject;
modScope.PROT_XMLFetcher = jslib.PROT_XMLFetcher;
modScope.RequestBackoff = jslib.RequestBackoff;
modScope.RequestBackoffV4 = jslib.RequestBackoffV4;
// We only need to call Init once.
modScope.Init = function() {};