Backed out changeset f8ae18a7d017 (bug 1143796)

This commit is contained in:
Wes Kocher 2015-03-27 15:31:10 -07:00
parent a5d4c6bab6
commit 640b6a0a85

View File

@ -86,8 +86,6 @@ const TELEMETRY_DELAY = 60000;
const TELEMETRY_TEST_DELAY = 100;
// Execute a scheduler tick every 5 minutes.
const SCHEDULER_TICK_INTERVAL_MS = 5 * 60 * 1000;
// When user is idle, execute a scheduler tick every 60 minutes.
const SCHEDULER_TICK_IDLE_INTERVAL_MS = 60 * 60 * 1000;
// The maximum number of times a scheduled operation can fail.
const SCHEDULER_RETRY_ATTEMPTS = 3;
@ -418,8 +416,6 @@ let TelemetryScheduler = {
// The timer which drives the scheduler.
_schedulerTimer: null,
// The interval used by the scheduler timer.
_schedulerInterval: 0,
_shuttingDown: true,
/**
@ -434,16 +430,14 @@ let TelemetryScheduler = {
let now = Policy.now();
this._lastDailyPingTime = now.getTime();
this._lastSessionCheckpointTime = now.getTime();
this._schedulerInterval = SCHEDULER_TICK_INTERVAL_MS;
this._rescheduleTimeout();
idleService.addIdleObserver(this, IDLE_TIMEOUT_SECONDS);
},
/**
* Reschedules the tick timer.
*/
_rescheduleTimeout: function() {
this._log.trace("_rescheduleTimeout - timeout: " + this._schedulerInterval);
this._log.trace("_rescheduleTimeout");
if (this._shuttingDown) {
this._log.warn("_rescheduleTimeout - already shutdown");
return;
@ -454,7 +448,7 @@ let TelemetryScheduler = {
}
this._schedulerTimer =
Policy.setSchedulerTickTimeout(() => this._onSchedulerTick(), this._schedulerInterval);
Policy.setSchedulerTickTimeout(() => this._onSchedulerTick(), SCHEDULER_TICK_INTERVAL_MS);
},
/**
@ -504,25 +498,6 @@ let TelemetryScheduler = {
.catch(e => this._log.error("_saveAbortedPing - Failed", e));
},
/**
* The notifications handler.
*/
observe: function(aSubject, aTopic, aData) {
this._log.trace("observe - aTopic: " + aTopic);
switch(aTopic) {
case "idle":
// If the user is idle, increase the tick interval.
this._schedulerInterval = SCHEDULER_TICK_IDLE_INTERVAL_MS;
this._rescheduleTimeout();
break;
case "active":
// User is back to work, restore the original tick interval.
this._schedulerInterval = SCHEDULER_TICK_INTERVAL_MS;
this._rescheduleTimeout();
break;
}
},
/**
* Performs a scheduler tick. This function manages Telemetry recurring operations.
* @return {Promise} A promise, only used when testing, resolved when the scheduled
@ -675,8 +650,6 @@ let TelemetryScheduler = {
this._schedulerTimer = null;
}
idleService.removeIdleObserver(this, IDLE_TIMEOUT_SECONDS);
this._shuttingDown = true;
}
};