MCPcopy Create free account
hub / github.com/coder/mux / readLease

Function readLease

src/node/services/workflows/WorkflowRunStore.ts:1265–1275  ·  view source on GitHub ↗
(leaseFile: string)

Source from the content-addressed store, hash-verified

1263}
1264
1265async function readLease(leaseFile: string): Promise<LeaseRecord | null> {
1266 try {
1267 const raw = JSON.parse(await fs.readFile(leaseFile, "utf-8")) as Partial<LeaseRecord>;
1268 if (typeof raw.ownerId === "string" && typeof raw.acquiredAtMs === "number") {
1269 return { ownerId: raw.ownerId, acquiredAtMs: raw.acquiredAtMs };
1270 }
1271 } catch {
1272 return null;
1273 }
1274 return null;
1275}

Callers 5

acquireLeaseMethod · 0.85
getLeaseRetryDelayMsMethod · 0.85
renewLeaseMethod · 0.85
releaseLeaseMethod · 0.85

Calls 2

readFileMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected