MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / disposeAll

Method disposeAll

src/utils/debugger/debugger-manager.ts:123–155  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121 }
122
123 async disposeAll(): Promise<void> {
124 const sessions = Array.from(this.sessions.values());
125 this.sessions.clear();
126 this.currentSessionId = null;
127
128 const runWithTimeout = async (
129 operation: () => Promise<void>,
130 timeoutMs: number,
131 ): Promise<void> => {
132 const timeoutPromise = new Promise<'timed_out'>((resolve) => {
133 const timer = setTimeout(() => resolve('timed_out'), timeoutMs);
134 timer.unref?.();
135 });
136
137 await Promise.race([
138 operation()
139 .then(() => 'completed' as const)
140 .catch(() => 'failed' as const),
141 timeoutPromise,
142 ]);
143 };
144
145 await Promise.allSettled(
146 sessions.map(async (session) => {
147 try {
148 await runWithTimeout(() => session.backend.detach(), 1000);
149 } finally {
150 await runWithTimeout(() => session.backend.dispose(), 1000);
151 session.releaseActivity();
152 }
153 }),
154 );
155 }
156
157 async addBreakpoint(
158 id: string | undefined,

Callers 4

runMcpShutdownFunction · 0.80

Calls 3

clearMethod · 0.65
detachMethod · 0.65
disposeMethod · 0.65

Tested by

no test coverage detected