-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider to support retry mechanism #40
Comments
FYI: Chromium has a retry mechanism of Reporting API. See this CL and this |
Retries are difficult. We are restricted in when we are allowed start fetches. If there are no instances of the the origin alive or just recently closed, the it could violate user expectations for retry network request created by that origin. If background-sync is enabled for the origin, Chrome privacy team are OK with it but on other browsers we can only initiate a request while the origin has a live instance or just as one is closing. It is not possible to retry a fetch initiated from an I think the TL;DR of my argument is that if you show me some existing code that does a delayed fetch, I can show you how to add a For sites that have not already implemented retries using If someone cares about maximizing reliability, they presumably currently they are already
We will ignore 1 since these people don't need For 2, with So for 2, this gives a strict increase in reliability. Adding automatic retries would allow those in 2 to remove retry logic. That seems nice but is not a requirement. |
That is accurate but it's also a false dichotomy; delayed fetch vs fetchLater are not the only 2 strategies out there. Another option is people that are spamming events UDP-style to maximize delivery reliability. That's the one I've seen actually used because delayed send (on the web) doesn't really work given all the problems with page lifecycle combined with network failures. The problem is network failures do happen, even in non-crash scenarios, especially in mobile contexts. Losing data sent via pending beacon (or the new In my use case, I need to report on how long someone stays on a given page. The solution I've inherited is the page sends a "heartbeat" gif request every Obviously this sucks for performance reasons. I have (not exaggerating) a few billion of these requests that happen per year. I would love to stop doing this, but every attempt to replace it with beacon transport fails:
I've run analytics for gif based and beacon based transports side-by-side, and it varies from day to day but the beacon messages are always less than their .gif counterparts, and it ranges anywhere from 1-10% when summing up billion messages. It's a big enough data loss that I can't get this solution past the data/management people.
I can appreciate that sentiment, but in the case of people building telemetry/analytics on a large scale, especially as a 3rd party vendor on a web page, I don't think pending beacon or fetchLater can work without having the browser make it's best effort to ensure these things send, and that includes some kind of retry mechanism related to network failures. |
There has been a long discussion around this topic (user expectation), and the current decision (#30 (comment)) is that fetchLater API should not send out any requests if no other same-origin site is open (in other tabs/iframes etc). In Chromium implementation for OT, it is even stricter that the browser will flush out all pending fetchLater requests for a document on it entering BFCache. Hence, the fact that it is not observable in DevTools (after the initiator document is closed) should not be related to a privacy issue. |
Offline discussion sugggests that the API should support some retry mechanism otherwise PendingBeacon is too unreliable.
bool field option
{retry: true}
: this option let the browser decide how to retry the failed beacon request.number field option
{retries: 10}
: this option let the user specify how many times the browser should retry the failed request. However, it might be very difficult to implement as: by default the beacons are sent out on page discard, and there really isn't much time left for a page to retry that many number of times, unless we are willing to let browser queue a failed request longer enough (privacy concern).Note to @fergald : Looking into the spec of Reporting API, it doesn't really support retry mechanism.
The text was updated successfully, but these errors were encountered: