MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / closeWorker

Function closeWorker

apps/desktop/main/worker/workerManager.ts:268–278  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

266 * 关闭 Worker(同步版本,用于一般场景)
267 */
268export function closeWorker(): void {
269 if (worker) {
270 // 先关闭所有数据库连接
271 sendToWorker('closeAll', {}).catch(() => {})
272
273 worker.terminate()
274 worker = null
275 rejectAllPending(new Error('Worker terminated'))
276 console.log('[WorkerManager] Worker terminated')
277 }
278}
279
280/**
281 * 关闭 Worker(异步版本,确保数据库连接关闭后再终止)

Callers

nothing calls this directly

Calls 3

sendToWorkerFunction · 0.85
rejectAllPendingFunction · 0.85
terminateMethod · 0.65

Tested by

no test coverage detected