MCPcopy Create free account
hub / github.com/Noumena-Network/code / hasCronTasksSync

Function hasCronTasksSync

src/utils/cronTasks.ts:164–176  ·  view source on GitHub ↗
(dir?: string)

Source from the content-addressed store, hash-verified

162 * cronScheduler.start() to decide whether to auto-enable. One file read.
163 */
164export function hasCronTasksSync(dir?: string): boolean {
165 let raw: string
166 try {
167 // eslint-disable-next-line custom-rules/no-sync-fs -- called once from cronScheduler.start()
168 raw = readFileSync(getReadableCronFilePath(dir), 'utf-8')
169 } catch {
170 return false
171 }
172 const parsed = safeParseJSON(raw, false)
173 if (!parsed || typeof parsed !== 'object') return false
174 const tasks = (parsed as Partial<CronFile>).tasks
175 return Array.isArray(tasks) && tasks.length > 0
176}
177
178/**
179 * Overwrite the canonical .ncode/scheduled_tasks.json with the given tasks.

Callers 1

startFunction · 0.85

Calls 2

readFileSyncFunction · 0.90
getReadableCronFilePathFunction · 0.85

Tested by

no test coverage detected