Conversation
Background tabs have different execution behaviors, as in heavily throttled timers and such. Because of that, when we're in the background, we're not going to update our latency or aggressively timeout the socket, when the tab wakes up then we'll restore our more proactive connection maintenance.
Bug:
|
Review NotesBug: Stale background pong cancels the active foreground timeout timerIn the if (
this.options.background_pinging ||
(this.options.ignore_pongs_before && client < this.options.ignore_pongs_before)
) {
if (this.timeout_timer) {
clearTimeout(this.timeout_timer);
this.timeout_timer = undefined;
}
return;
}Consider the background → foreground transition sequence:
The connection can now go dead immediately after returning to the foreground and no The issue is that Design concern:
|
|
@claude pretty sure it's safe to clear that timer right there and then attempt to clear it again after all the rest of the code potentially runs. Also I don't think we want to manage that ignore_pongs_before field, there's no reason to and if there were somehow multiple pongs that came back that were before that field we'd want to ignore them all. |
|
Claude finished @anoek's task in 50s —— View job Analysis complete
You're correct on both points. Looking at the actual code, the automated reviews were describing a slightly different structure than what's actually there — the On clearing the timer in the discard path: The scenario the reviews flagged (stale pong clears the freshly-armed foreground timer) can happen, but it's not a silent permanent failure:
Clearing in both the discard and accept paths is safe. On Agreed — the class shouldn't own that lifecycle. It's a caller-set filter for a specific transition moment, and if multiple stale pongs trickle in after a background→foreground switch, rejecting them all is the correct behavior. Managing it internally would just add complexity for no benefit. The automated review comments appear to be false positives here. |
Background tabs have different execution behaviors, as in heavily throttled timers and such. Because of that, when we're in the background, we're not going to update our latency or aggressively timeout the socket, when the tab wakes up then we'll restore our more proactive connection maintenance.