-
Notifications
You must be signed in to change notification settings - Fork 255
Open
Description
Missing Telemetry When Switching Tabs - Request for AbortController Integration
Problem Description
I'm experiencing missing telemetry data when users switch tabs, with the beacon API disabled as it is not reliable. Fetch requests appear to get stuck in a pending state when tabs are backgrounded and don't resume properly when foregrounded, leading to telemetry loss.
Perhaps these requests can be configured to be aborted? Then, an offline or localstorage channel can retry when the tab is foregrounded
Current Behavior (Without Beacon API)
- On pagehide: Fetch requests initiated before tab backgrounding remain in pending state indefinitely
- On Tab Foregrounding: Pending fetch requests don't resume
Observed Issues in SenderPostManager.ts
_doFetchSenderfunction doesn't implement request cancellation- Fetch requests can hang indefinitely during tab backgrounding
doAwaitResponsecallback may never execute for suspended requests
Proposed Solution
I'd like to propose the following enhancements:
1. AbortController Integration
- Add
AbortControllersupport to_doFetchSenderfunction - Cancel active fetch requests on
pagehideevent if beacon is not being used or if telemetry is stored through an offline channel. - Error handling will allow using localstorage type channel to queue telemetry for later sending
Use Case
My application needs reliable telemetry delivery, and I prefer to:
- Disable beacon API, as beacon is not working consistently and we don't want gaps
- Use a local storage channel to store telemetry when pending fetches are aborted
- Abort hanging requests cleanly rather than letting them accumulate
- Ensure telemetry is eventually sent if/when users return to tab
Metadata
Metadata
Assignees
Labels
No labels