fix(scheduler): Resolve CI module export error in lock-utils

- Fix `SyntaxError: The requested module './lock-utils.mjs' does not provide an export named 'withTimeout'` by refactoring exports in `src/lock-utils.mjs`.
- Explicitly import `relayListLabel` and `mergeRelayList` from `src/utils.mjs` before exporting them to avoid ambiguous export behavior in some environments.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-21 19:46:26 +00:00
1 parent cb8ded018a
commit ef22045a61
11 files changed
+61 -24

No files matched your search

+11 -2
View File
@@ -1,9 +1,9 @@
import fs from 'node:fs/promises';
import path from 'node:path';
import { randomInt } from 'node:crypto';
import { todayDateStr, getIsoWeekStr } from './utils.mjs';
import { todayDateStr, getIsoWeekStr, relayListLabel, mergeRelayList } from './utils.mjs';
export { relayListLabel, mergeRelayList } from './utils.mjs';
export { relayListLabel, mergeRelayList };
/**
* Scans the local log directory to identify agents that have already completed their task
@@ -51,6 +51,15 @@ export async function getCompletedAgents(cadence, logDir, deps) {
return completed;
}
export function withTimeout(promise, timeoutMs, timeoutMessage) {
let timeoutHandle;
const timeoutPromise = new Promise((_, reject) => {
timeoutHandle = setTimeout(() => reject(new Error(timeoutMessage)), timeoutMs);
});
return Promise.race([promise, timeoutPromise]).finally(() => {
if (timeoutHandle) clearTimeout(timeoutHandle);
});
}
const MAX_RANDOM = 281474976710655; // 2**48 - 1