MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / flushSync

Function flushSync

packages/cli/src/telemetry/client.ts:151–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149 * so the parent process exits immediately without waiting.
150 */
151export function flushSync(): void {
152 const payload = drainQueueToPayload();
153 if (payload == null) return;
154
155 try {
156 const { spawn } = require("node:child_process") as typeof import("node:child_process");
157 const child = spawn(
158 process.execPath,
159 [
160 "-e",
161 `fetch(${JSON.stringify(`${POSTHOG_HOST}/batch/`)},{method:"POST",headers:{"Content-Type":"application/json"},body:${JSON.stringify(payload)},signal:AbortSignal.timeout(${FLUSH_TIMEOUT_MS})}).catch(()=>{})`,
162 ],
163 { detached: true, stdio: "ignore" },
164 );
165 // Let the parent exit without waiting for the child
166 child.unref();
167 } catch {
168 // Silently ignore
169 }
170}
171
172/**
173 * Show the first-run telemetry notice if it hasn't been shown yet.

Callers

nothing calls this directly

Calls 2

drainQueueToPayloadFunction · 0.85
spawnFunction · 0.50

Tested by

no test coverage detected