MCPcopy Index your code
hub / github.com/anomalyco/opencode / stopAndFlush

Function stopAndFlush

packages/desktop/src/main/unresponsive.ts:38–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36 }
37
38 const stopAndFlush = () => {
39 const wasSampling = sampling
40 sampling = false
41 clearTimers()
42 if (samples.size === 0) return wasSampling
43
44 const entries = [...samples.entries()].sort((a, b) => b[1] - a[1])
45 const total = entries.reduce((sum, entry) => sum + entry[1], 0)
46 const message = [
47 "renderer unresponsive samples",
48 `Window: ${name}`,
49 `URL: ${win.isDestroyed() ? "<destroyed>" : win.webContents.getURL()}`,
50 ...entries.map((entry) => `<${entry[1]}> ${entry[0]}`),
51 `Total Samples: ${total}`,
52 ].join("\n")
53 writeLog("window", message, undefined, "error")
54 samples.clear()
55 return wasSampling
56 }
57
58 const start = () => {
59 if (sampling || win.isDestroyed() || win.webContents.isDestroyed() || win.webContents.isDevToolsOpened()) return

Callers

nothing calls this directly

Calls 2

clearTimersFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected