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

Function ensureTaskListLockFile

src/utils/tasks.ts:512–524  ·  view source on GitHub ↗

* Ensures the lock file exists for a task list

(taskListId: string)

Source from the content-addressed store, hash-verified

510 * Ensures the lock file exists for a task list
511 */
512async function ensureTaskListLockFile(taskListId: string): Promise<string> {
513 await ensureTasksDir(taskListId)
514 const lockPath = getTaskListLockPath(taskListId)
515 // proper-lockfile requires the target file to exist. Create it with the
516 // 'wx' flag (write-exclusive) so concurrent callers don't both create it,
517 // and the first one to create wins silently.
518 try {
519 await writeFile(lockPath, '', { flag: 'wx' })
520 } catch {
521 // EEXIST or other — file already exists, which is fine.
522 }
523 return lockPath
524}
525
526export type ClaimTaskOptions = {
527 /**

Callers 3

resetTaskListFunction · 0.85
createTaskFunction · 0.85
claimTaskWithBusyCheckFunction · 0.85

Calls 2

ensureTasksDirFunction · 0.85
getTaskListLockPathFunction · 0.85

Tested by

no test coverage detected