Skip to content

Commit 5b53361

Browse files
committed
Bug 1944432 - Set background update reasons to not update correctly. r=chutten,application-update-reviewers,bytesized
First, this commit awaits the helper method. Second, this commit removes `testGetValue`, which should never have been used in production code -- it is test-only. Overflow errors will be caught and recorded by Glean. Differential Revision: https://phabricator.services.mozilla.com/D229567
1 parent 1ec549b commit 5b53361

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

toolkit/mozapps/update/BackgroundUpdate.sys.mjs

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ export var BackgroundUpdate = {
281281
reasons.push(this.REASON.MANUAL_UPDATE_ONLY);
282282
}
283283

284-
this._recordGleanMetrics(reasons);
284+
await this._recordGleanMetrics(reasons);
285285

286286
return reasons;
287287
},
@@ -337,7 +337,7 @@ export var BackgroundUpdate = {
337337
}
338338
}
339339

340-
this._recordGleanMetrics(reasons);
340+
await this._recordGleanMetrics(reasons);
341341

342342
return reasons;
343343
},
@@ -991,28 +991,15 @@ export var BackgroundUpdate = {
991991
/**
992992
* Local helper function to record all reasons why the background updater is
993993
* not used with Glean. This function will only track the first 20 reasons.
994-
* It is also fault tolerant and will only display debug messages if the
995-
* metric cannot be recorded for any reason.
996994
*
997-
* @param {array of strings} [reasons]
995+
* @param {[string]} [reasons]
998996
* a list of BackgroundUpdate.REASON values (=> string)
999997
*/
1000998
async _recordGleanMetrics(reasons) {
1001999
// Record Glean metrics with all the reasons why the update was impossible.
10021000
for (const [key, value] of Object.entries(this.REASON)) {
10031001
if (reasons.includes(value)) {
1004-
try {
1005-
// `testGetValue` throws a `DataError` in case
1006-
// of `InvalidOverflow` and other outstanding errors.
1007-
Glean.backgroundUpdate.reasonsToNotUpdate.testGetValue();
1008-
Glean.backgroundUpdate.reasonsToNotUpdate.add(key);
1009-
} catch (e) {
1010-
// Debug print an error message and break the loop to avoid Glean
1011-
// messages on the console would otherwise be caused by the add().
1012-
lazy.log.debug("Error recording reasonsToNotUpdate");
1013-
console.log("Error recording reasonsToNotUpdate");
1014-
break;
1015-
}
1002+
Glean.backgroundUpdate.reasonsToNotUpdate.add(key);
10161003
}
10171004
}
10181005
},

0 commit comments

Comments
 (0)