MCPcopy Create free account
hub / github.com/coder/mux / finishFlow

Method finishFlow

src/node/services/copilotOauthService.ts:263–283  ·  view source on GitHub ↗
(flowId: string, result: Result<void, string>)

Source from the content-addressed store, hash-verified

261 }
262
263 private finishFlow(flowId: string, result: Result<void, string>): void {
264 const flow = this.flows.get(flowId);
265 if (!flow || flow.cancelled) return;
266
267 flow.cancelled = true;
268 clearTimeout(flow.timeout);
269
270 try {
271 flow.resolveResult(result);
272 } catch {
273 // Already resolved
274 }
275
276 // Keep completed flow briefly so callers can still await
277 if (flow.cleanupTimeout !== null) {
278 clearTimeout(flow.cleanupTimeout);
279 }
280 flow.cleanupTimeout = setTimeout(() => {
281 this.flows.delete(flowId);
282 }, COMPLETED_FLOW_TTL_MS);
283 }
284}

Callers 4

startDeviceFlowMethod · 0.95
waitForDeviceFlowMethod · 0.95
cancelDeviceFlowMethod · 0.95
pollForTokenMethod · 0.95

Calls 2

getMethod · 0.65
deleteMethod · 0.45

Tested by

no test coverage detected