MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / stopInternalServer

Function stopInternalServer

apps/desktop/main/internal-api.ts:307–336  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

305}
306
307export async function stopInternalServer(): Promise<void> {
308 if (!server) return
309 try {
310 await server.close()
311 } catch (err) {
312 console.error('[InternalAPI] Error closing server:', err)
313 } finally {
314 try {
315 mergeCache?.clear()
316 } catch {
317 /* best-effort */
318 }
319 try {
320 dbManager?.closeAll()
321 } catch {
322 /* best-effort */
323 }
324 try {
325 await semanticIndexService?.close()
326 } catch {
327 /* best-effort */
328 }
329 server = null
330 endpoint = null
331 dbManager = null
332 mergeCache = null
333 semanticIndexService = null
334 console.log('[InternalAPI] Server stopped')
335 }
336}
337
338/**
339 * Register IPC handler so the Renderer can retrieve the endpoint via preload.

Callers 1

mainAppEventsMethod · 0.90

Calls 4

closeAllMethod · 0.80
closeMethod · 0.65
errorMethod · 0.65
clearMethod · 0.65

Tested by

no test coverage detected