mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-18 06:45:33 +00:00
Bug 994727 - Telemetry experiments: Fix disabling the feature. r=bsmedberg
This commit is contained in:
parent
31ff5e9a1c
commit
acbb3e6fd1
@ -586,6 +586,10 @@ Experiments.Experiments.prototype = {
|
||||
do {
|
||||
this._log.trace("_main iteration");
|
||||
yield this._loadTask;
|
||||
if (!gExperimentsEnabled) {
|
||||
this._refresh = false;
|
||||
}
|
||||
|
||||
if (this._refresh) {
|
||||
yield this._loadManifest();
|
||||
}
|
||||
@ -879,7 +883,11 @@ Experiments.Experiments.prototype = {
|
||||
// Make sure we keep experiments that are or were running.
|
||||
// We remove them after KEEP_HISTORY_N_DAYS.
|
||||
for (let [id, entry] of this._experiments) {
|
||||
if (experiments.has(id) || !entry.startDate || entry.shouldDiscard()) {
|
||||
if (experiments.has(id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!entry.startDate || entry.shouldDiscard()) {
|
||||
this._log.trace("updateExperiments() - discarding entry for " + id);
|
||||
continue;
|
||||
}
|
||||
@ -983,6 +991,8 @@ Experiments.Experiments.prototype = {
|
||||
+ activeExperiment.id);
|
||||
activeExperiment = null;
|
||||
activeChanged = true;
|
||||
} else if (!gExperimentsEnabled) {
|
||||
// No further actions if the feature is disabled.
|
||||
} else if (activeExperiment.needsUpdate) {
|
||||
this._log.debug("evaluateExperiments() - updating experiment "
|
||||
+ activeExperiment.id);
|
||||
@ -1005,7 +1015,7 @@ Experiments.Experiments.prototype = {
|
||||
}
|
||||
this._terminateReason = null;
|
||||
|
||||
if (!activeExperiment) {
|
||||
if (!activeExperiment && gExperimentsEnabled) {
|
||||
for (let [id, experiment] of this._experiments) {
|
||||
let applicable;
|
||||
let reason = null;
|
||||
@ -1698,8 +1708,13 @@ Experiments.ExperimentEntry.prototype = {
|
||||
*/
|
||||
maybeStop: function () {
|
||||
this._log.trace("maybeStop()");
|
||||
return Task.spawn(function* ExperimentEntry_maybeStop_task() {
|
||||
if (!gExperimentsEnabled) {
|
||||
this._log.warn("maybeStop() - should not get here");
|
||||
yield this.stop(TELEMETRY_LOG.TERMINATION.FROM_API);
|
||||
return true;
|
||||
}
|
||||
|
||||
return Task.spawn(function ExperimentEntry_maybeStop_task() {
|
||||
let result = yield this._shouldStop();
|
||||
if (result.shouldStop) {
|
||||
let expireReasons = ["endTime", "maxActiveSeconds"];
|
||||
@ -1710,7 +1725,7 @@ Experiments.ExperimentEntry.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
throw new Task.Result(result.shouldStop);
|
||||
return result.shouldStop;
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user