Called when a session is disposed OR resolved. Closes idle watchers.
(session: PersistentSession)
| 267 | |
| 268 | /** Called when a session is disposed OR resolved. Closes idle watchers. */ |
| 269 | unregister(session: PersistentSession): void { |
| 270 | for (const [key, entry] of this.entries.entries()) { |
| 271 | const idx = entry.pending.findIndex((p) => p.session === session); |
| 272 | if (idx < 0) continue; |
| 273 | entry.pending.splice(idx, 1); |
| 274 | if (entry.pending.length === 0) { |
| 275 | try { |
| 276 | entry.watcher.close(); |
| 277 | } catch { |
| 278 | // ignore |
| 279 | } |
| 280 | this.entries.delete(key); |
| 281 | } |
| 282 | } |
| 283 | for (const [key, entry] of this.pollEntries.entries()) { |
| 284 | const idx = entry.pending.findIndex((p) => p.session === session); |
| 285 | if (idx < 0) continue; |
| 286 | entry.pending.splice(idx, 1); |
| 287 | if (entry.pending.length === 0) this.stopPoll(key); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | disposeAll(): void { |
| 292 | for (const entry of this.entries.values()) { |