MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / scheduleCleanup

Function scheduleCleanup

projects/electron/src/modules/code/process.ts:208–232  ·  view source on GitHub ↗

* Schedule cleanup of completed process buffer after 30 minutes

(processId: string)

Source from the content-addressed store, hash-verified

206 * Schedule cleanup of completed process buffer after 30 minutes
207 */
208function scheduleCleanup(processId: string): void {
209 const proc = activeProcesses.get(processId)
210 if (!proc) return
211
212 // Clear any existing cleanup timeout
213 if (proc.cleanupTimeoutId) {
214 clearTimeout(proc.cleanupTimeoutId)
215 }
216
217 proc.cleanupTimeoutId = setTimeout(() => {
218 logger.info("[Process] Auto-cleanup triggered for process", JSON.stringify({ processId }))
219 const p = activeProcesses.get(processId)
220 if (p) {
221 // Clean up temp script if exists
222 if (p.tempScriptPath && fs.existsSync(p.tempScriptPath)) {
223 try {
224 fs.unlinkSync(p.tempScriptPath)
225 } catch (e) {
226 logger.warn("[Process] Failed to clean up temp script", JSON.stringify({ path: p.tempScriptPath, error: e }))
227 }
228 }
229 activeProcesses.delete(processId)
230 }
231 }, CLEANUP_DELAY_MS)
232}
233
234/**
235 * Send output chunk to renderer

Callers 3

sendExitFunction · 0.70
sendErrorFunction · 0.70
reconnectRuntimeProcessFunction · 0.70

Calls 2

getMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected