Commit 6c6dc3ce authored by MozLando's avatar MozLando
Browse files

Merge #4674

4674: 1586881: Fix high error rate on glean.baseline.duration r=mdboom a=mdboom

There is a race condition in how the TimingManager is used here.
When stopping a timer, we dispatch a task to actually record the value in the
timespan, and only reset the TimingManager in that async task after the
recording, which requires I/O, is complete.

If the timespan is started in the meantime, an error will be recorded, rather
than safely starting a new timespan measurement.

This change could be considered on the principle (followed elsewhere), that
we do timing management and measurement synchronously, and only recording
Co-authored-by: default avatarMichael Droettboom <>
parents cf633e98 46a54476
......@@ -83,11 +83,11 @@ data class TimespanMetricType(
Dispatchers.API.launch {
TimespansStorageEngine.set(this@TimespanMetricType, timeUnit, elapsedNanos)
// Reset the timerId.
timerId = null
// Reset the timerId.
timerId = null
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment