Commit a843858
committed
MonitorScope: pause()/resume() so background tabs don't keep an open WS
Adds pause()/resume() alongside existing start()/stop():
- pause(): stops the underlying pryv.Monitor (closes socket.io transport)
but preserves accumulated state (events, streamsByID, oldestLoadedTime,
maxModified). No-op if already paused or stopped.
- resume(): rebuilds the live monitor with the current maxModified so the
catch-up events.get returns only what changed during the pause. No-op
if not paused or already stopped.
- Extracts the existing live-monitor-build path into attachLiveMonitor()
so start() and resume() share the same code.
Driven by the 2026-04-29 hds-prod-open-pryv-io incident where a single
backgrounded tab held a socket.io reconnect loop for ~5 days. v3.0.2 +
v3.0.3 of @pryv/socket.io already cap the loop; this is the third belt
— browser-tab visibility now severs the WS entirely, so backgrounded
sessions don't even attempt to keep one open. See
_macro/_plans/_TEMP/SESSION-2026-05-04.md.1 parent 11a75a6 commit a843858
1 file changed
Lines changed: 42 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
133 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
134 | 146 | | |
135 | 147 | | |
136 | 148 | | |
| |||
162 | 174 | | |
163 | 175 | | |
164 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
165 | 206 | | |
166 | 207 | | |
167 | 208 | | |
| |||
0 commit comments