MCPcopy Index your code
hub / github.com/ByBrawe/opencode-loop / doctorLoop

Function doctorLoop

src/index.js:1559–1572  ·  view source on GitHub ↗
(directory, client, sessionID)

Source from the content-addressed store, hash-verified

1557 }
1558 if (active && activeAge >= activeGuard) clearActiveRun(sessionID)
1559
1560 const state = await readState(directory, sessionID)
1561 for (const candidate of state.jobs || []) {
1562 if (candidate.watchPaths?.length && !candidate.paused && candidate.enabled && await watchChanged(directory, candidate)) candidate.lastRunAt = 0
1563 }
1564 const due = dueJobs(state, options.force)
1565 if (!due.length) {
1566 await writeState(directory, sessionID, state)
1567 await reschedule()
1568 return
1569 }
1570 job = due[0]
1571
1572 if (job.maxRuntimeMs > 0 && now() - Date.parse(job.createdAt || new Date().toISOString()) >= job.maxRuntimeMs) {
1573 state.jobs = (state.jobs || []).filter((candidate) => candidate.id !== job.id)
1574 await writeState(directory, sessionID, state)
1575 await notifyJob(directory, job, "max_runtime_reached")

Callers 1

handleCommandFunction · 0.85

Calls 3

readStateFunction · 0.85
sayFunction · 0.85
stateDirFunction · 0.85

Tested by

no test coverage detected