Closed Bug 1835175 Opened 11 months ago Closed 9 months ago

Idle trigger calculates idle/silent time incorrectly

Categories

(Firefox :: Messaging System, defect, P1)

defect

Tracking

()

RESOLVED FIXED
117 Branch
Tracking Status
firefox117 --- fixed

People

(Reporter: aminomancer, Assigned: aminomancer)

References

(Blocks 1 open bug)

Details

(Whiteboard: [omc])

Attachments

(1 file)

Over here, the idle trigger tries to check the number of milliseconds that have elapsed since the user went idle and sound stopped playing. (It checks for sound because a user might stop interacting with the browser even though they're actively watching a movie on netflix or something) Then it will expose this duration to message targeting so we can show messages exclusively to users who have been idle for 20+ minutes.

But the math is wrong here, it's trying to find how much time has passed since the last user interaction or audio, meaning we want to report "idle for milliseconds" or "silent for milliseconds", whichever is shorter. But idle time and silent time are stored as epochs, not as durations. So we don't want Math.min() to find the shortest duration, we want Math.max(), to get the most recent idle or silent epoch, and subtract it from the current epoch, to get the overall time that has passed without an interaction or a sound.

So the fix is very simple, we just need to change Math.min to Math.max.

See Also: → 1786336
See Also: → 1835158
Assignee: nobody → shughes
Status: NEW → ASSIGNED

What about the dashboard use case? I use firefox to display prometheus dashboards. These play no sound or other media and are "idle" but should not fire this trigger.

This bug is fixing the timing of the idle trigger which can be used for many things not just promotions. Filed bug 1835481 for confusion of unrelated pages.

See Also: → 1835481
Severity: -- → S2
Priority: -- → P1
Whiteboard: [omc]
Pushed by shughes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/908732e4f89c
Fix idle trigger idle time calculation. r=omc-reviewers,jprickett
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: