mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-11-08 13:52:16 +00:00
[decompose] extract RelayHealthManager and LockPublisher from src/lock-ops.mjs
- Extracted `RelayHealthManager` to `src/relay-health-manager.mjs` - Extracted `LockPublisher` to `src/lock-publisher.mjs` - Moved shared utilities to `src/lock-utils.mjs` - Updated `src/lock-ops.mjs` to import dependencies and re-export public API - Reduced `src/lock-ops.mjs` from 880 to 152 lines - Verified with tests (295 passed) and linting Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
e10528141d
commit
8653521593
10 files changed
+860
-739
No files matched your search
@@ -47,3 +47,21 @@ 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);
|
||||
});
|
||||
}
|
||||
|
||||
export function relayListLabel(relays) {
|
||||
return relays.join(', ');
|
||||
}
|
||||
|
||||
export function mergeRelayList(primaryRelays, fallbackRelays) {
|
||||
return [...new Set([...primaryRelays, ...fallbackRelays])];
|
||||
}
|
||||
Reference in new issue
Block a user