MCPcopy Index your code
hub / github.com/simstudioai/sim / resetWorkerIdleTimeout

Function resetWorkerIdleTimeout

apps/sim/lib/execution/isolated-vm.ts:874–891  ·  view source on GitHub ↗
(workerId: number)

Source from the content-addressed store, hash-verified

872}
873
874function resetWorkerIdleTimeout(workerId: number) {
875 const workerInfo = workers.get(workerId)
876 if (!workerInfo) return
877
878 if (workerInfo.idleTimeout) {
879 clearTimeout(workerInfo.idleTimeout)
880 workerInfo.idleTimeout = null
881 }
882
883 if (workerInfo.activeExecutions === 0) {
884 workerInfo.idleTimeout = setTimeout(() => {
885 const w = workers.get(workerId)
886 if (w && w.activeExecutions === 0) {
887 cleanupWorker(workerId)
888 }
889 }, WORKER_IDLE_TIMEOUT_MS)
890 }
891}
892
893function spawnWorker(): Promise<WorkerInfo> {
894 const workerId = nextWorkerId++

Callers 3

handleWorkerMessageFunction · 0.85
readyHandlerFunction · 0.85
dispatchToWorkerFunction · 0.85

Calls 2

cleanupWorkerFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected