MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / unregister

Method unregister

src/workspaces/transcript-watcher.ts:269–289  ·  view source on GitHub ↗

Called when a session is disposed OR resolved. Closes idle watchers.

(session: PersistentSession)

Source from the content-addressed store, hash-verified

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()) {

Callers 1

onEventMethod · 0.95

Calls 3

stopPollMethod · 0.95
closeMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected