MCPcopy
hub / github.com/claude-code-best/claude-code / removeCronTasks

Function removeCronTasks

src/utils/cronTasks.ts:231–248  ·  view source on GitHub ↗
(
  ids: string[],
  dir?: string,
)

Source from the content-addressed store, hash-verified

229 * state on that path (tests enforce this).
230 */
231export async function removeCronTasks(
232 ids: string[],
233 dir?: string,
234): Promise<void> {
235 if (ids.length === 0) return
236 // Sweep session store first. If every id was accounted for there, we're
237 // done — skip the file read entirely. removeSessionCronTasks is a no-op
238 // (returns 0) on miss, so pre-existing durable-delete paths fall through
239 // without allocating.
240 if (dir === undefined && removeSessionCronTasks(ids) === ids.length) {
241 return
242 }
243 const idSet = new Set(ids)
244 const tasks = await readCronTasks(dir)
245 const remaining = tasks.filter(t => !idSet.has(t.id))
246 if (remaining.length === tasks.length) return
247 await writeCronTasks(remaining, dir)
248}
249
250/**
251 * Stamp `lastFiredAt` on the given recurring tasks and write back. Batched

Callers 5

callFunction · 0.85
loadFunction · 0.85
processFunction · 0.85
useScheduledTasksFunction · 0.85

Calls 4

removeSessionCronTasksFunction · 0.85
readCronTasksFunction · 0.85
writeCronTasksFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected