Make sync service check score before syncing: bug #434816 (r=thunder)

This commit is contained in:
Anant Narayanan 2008-06-10 13:45:37 -07:00
parent 9c1413e024
commit 9cb5d2c8cc

View File

@ -209,7 +209,7 @@ WeaveSvc.prototype = {
this._scheduleTimer = Cc["@mozilla.org/timer;1"].
createInstance(Ci.nsITimer);
let listener = new Utils.EventListener(Utils.bind2(this, this._onSchedule));
this._scheduleTimer.initWithCallback(listener, 1800000, // 30 min
this._scheduleTimer.initWithCallback(listener, 120000, // 2 min
this._scheduleTimer.TYPE_REPEATING_SLACK);
this._log.info("Weave scheduler enabled");
},
@ -504,7 +504,7 @@ WeaveSvc.prototype = {
let engines = Engines.getAll();
for (let i = 0; i < engines.length; i++) {
if (engines[i].enabled) {
if (engines[i].enabled && engines[i]._tracker.score >= 30) {
this._notify(engines[i].name + "-engine:sync",
this._syncEngine, engines[i]).async(this, self.cb);
yield;
@ -520,6 +520,8 @@ WeaveSvc.prototype = {
try {
engine.sync(self.cb);
yield;
engine._tracker.resetScore();
yield;
} catch(e) {
this._log.error(Utils.exceptionStr(e));
if (e.trace)