MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / shutdown

Method shutdown

packages/telemetry/src/client.ts:118–138  ·  view source on GitHub ↗
(options: TelemetryShutdownOptions = {})

Source from the content-addressed store, hash-verified

116 }
117
118 async shutdown(options: TelemetryShutdownOptions = {}): Promise<void> {
119 const sink = this.sink;
120 if (sink === null) return;
121 sink.stopPeriodicFlush();
122 if (options.timeoutMs === undefined) {
123 await sink.flush();
124 return;
125 }
126 const controller = new AbortController();
127 const timer = setTimeout(() => {
128 controller.abort();
129 }, options.timeoutMs);
130 timer.unref?.();
131 try {
132 await sink.flush(controller.signal);
133 } catch {
134 sink.flushSync();
135 } finally {
136 clearTimeout(timer);
137 }
138 }
139
140 resetForTests(): void {
141 this.sink?.stopPeriodicFlush();

Callers 2

shutdownMethod · 0.45
shutdownFunction · 0.45

Calls 4

stopPeriodicFlushMethod · 0.80
flushMethod · 0.65
abortMethod · 0.65
flushSyncMethod · 0.65

Tested by

no test coverage detected