Skip to content

waygraph / claimOnce

Function: claimOnce() ​

claimOnce(name, opts?): Promise<boolean>

Defined in: src/engine/claim.ts:18

Claims name for this run: true the first time any process on this machine asks, false after (until ttlMs passes - default 30 minutes - so a later run can claim it again). Atomic: two workers asking at once get one true.

Parameters ​

name ​

string

opts? ​

ttlMs? ​

number

Returns ​

Promise<boolean>

Example ​

ts
for (const row of await rows.all()) {
  if (await claimOnce(`mail:${await row.getAttribute("href")}`)) return row.click();
}

waygraph 0.18.3 (alpha) · Node 24+ · peer @playwright/test ^1.40.0 · syntax may change before 1.0: see what was removed