Add a timeout mechanism for quick suggest fetches from Merino
Categories
(Firefox :: Address Bar, task, P1)
Tracking
()
People
(Reporter: adw, Assigned: adw)
References
Details
Attachments
(1 file)
48 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
RyanVM
:
approval-mozilla-release+
|
Details | Review |
We should add a timeout mechanism to Merino fetches and fall back to remote settings on timeout.
We use fetch
to send requests. The fetch
spec doesn't define a timeout, the MDN docs don't mention one, and there doesn't seem to be an explicit timeout in the Gecko implementation. I imagine somewhere in Necko there's a timeout but it's probably large, and I haven't had time to test it yet.
Judging by some googling, the typical way of implementing a timeout using fetch
is just a setTimeout
plus AbortController
. We already have an abort controller used for canceling the fetch when the query is canceled.
I talked about this with Nan and mythmon. I think we have three options vis-a-vis timeouts and our two sources of suggestions, remote settings and Merino, assuming we still start the fetches from both sources concurrently:
- Race to the highest-priority suggestion: As soon as the RS fetch finishes, add its suggestion if the Merino suggestion hasn't already been added. As soon as the Merino fetch finishes, add its suggestion unconditionally. The downside is that the RS suggestion will be replaced by the Merino suggestion in the common case, assuming RS is faster than Merino. That will cause flicker in the UI, and we have too much flicker already.
- Modified race to the highest-priority suggestion: When RS finishes, add its suggestion if the Merino suggestion hasn't already been added and only after some small timeout has elapsed. When Merino finishes, add its suggestion unconditionally. This might improve the flicker problem of option 1, but it might not, depending on timing.
- Hard timeout for Merino: Cancel the Merino fetch after some timeout. Don't add either suggestion before the timeout elapses.
We decided we'll do option 3.
No reason not to add a Nimbus variable for the timeout value.
FWIW none of the other front-end fetch
callers seem to use timeouts at all -- not a good excuse we shouldn't ofc.
Assignee | ||
Comment 1•3 years ago
|
||
This adds a 200ms timeout using setTimeout
and the current AbortController
.
The timeout value can be set in prefs and Nimbus.
Pushed by dwillcoxon@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9ff0042f482d Add a timeout mechanism for quick suggest fetches from Merino. r=nanj
Comment 3•3 years ago
|
||
bugherder |
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 4•3 years ago
|
||
Comment on attachment 9248171 [details]
Bug 1737928 - Add a timeout mechanism for quick suggest fetches from Merino.
Beta/Release Uplift Approval Request
- User impact if declined: We need this for the Firefox Suggest preferences redesign targeting 95/94.
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: Please see uplift spreadsheet: https://docs.google.com/spreadsheets/d/1LavihS-VOPFYEyum7mrx6FKXmuQeHi9xQHfGNSxjnoY/edit?usp=sharing
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): This only affects Firefox Suggest suggestions returned from the Merino server. Currently such suggestions are disabled for all users and will only be enabled initially in a future Nimbus rollout.
- String changes made/needed:
Comment 5•3 years ago
|
||
Comment on attachment 9248171 [details]
Bug 1737928 - Add a timeout mechanism for quick suggest fetches from Merino.
Approved for 95.0b5.
Comment 6•3 years ago
|
||
bugherder uplift |
Assignee | ||
Comment 7•2 years ago
|
||
[Tracking Requested - why for this release]: We need this for the Firefox Suggest preferences redesign targeting 95/94.
Assignee | ||
Comment 8•2 years ago
|
||
Comment on attachment 9248171 [details]
Bug 1737928 - Add a timeout mechanism for quick suggest fetches from Merino.
Beta/Release Uplift Approval Request
- User impact if declined: We need this for the Firefox Suggest preferences redesign targeting 95/94.
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: Please see uplift spreadsheet: https://docs.google.com/spreadsheets/d/1LavihS-VOPFYEyum7mrx6FKXmuQeHi9xQHfGNSxjnoY/edit?usp=sharing
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): This only affects Firefox Suggest suggestions returned from the Merino server. Currently such suggestions are disabled for all users and will only be enabled initially in a future Nimbus rollout.
- String changes made/needed:
Updated•2 years ago
|
Comment 9•2 years ago
|
||
Comment on attachment 9248171 [details]
Bug 1737928 - Add a timeout mechanism for quick suggest fetches from Merino.
Approved for 94.0.2.
Comment 10•2 years ago
|
||
bugherder uplift |
Description
•