Merge branch 'main' into fix/governance-command-injection-10151244085139343159

This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-02-21 14:39:11 -05:00
commit a0c66686c5
6 files changed
+15 -5

No files matched your search

+1 -2
View File
@@ -8,12 +8,11 @@ import {
KIND_APP_DATA,
MS_PER_SECOND,
} from './constants.mjs';
import { nowUnix } from './utils.mjs';
import { nowUnix, relayListLabel } from './utils.mjs';
import { defaultHealthManager, buildRelayHealthConfig, RelayHealthManager } from './relay-health-manager.mjs';
import { publishLock, LockPublisher } from './lock-publisher.mjs';
import {
withTimeout,
relayListLabel,
mergeRelayList,
secureRandom,
} from './lock-utils.mjs';
+1
View File
@@ -6,6 +6,7 @@ import {
getRelayFallbacks,
getMinActiveRelayPool,
} from './torch-config.mjs';
import { mergeRelayList, relayListLabel, withTimeout } from './utils.mjs';
import { defaultHealthManager, buildRelayHealthConfig } from './relay-health-manager.mjs';
import { relayListLabel } from './utils.mjs';
import { mergeRelayList, withTimeout } from './lock-utils.mjs';
+1 -1
View File
@@ -3,7 +3,7 @@ import path from 'node:path';
import { randomInt } from 'node:crypto';
import { todayDateStr, getIsoWeekStr } from './utils.mjs';
export { relayListLabel } from './utils.mjs';
export { relayListLabel, withTimeout, mergeRelayList } from './utils.mjs';
/**
* Scans the local log directory to identify agents that have already completed their task
+1 -1
View File
@@ -4,7 +4,7 @@ import WebSocket from 'ws';
import { finalizeEvent, generateSecretKey, getPublicKey } from 'nostr-tools/pure';
import { getNamespace, getRelays } from './torch-config.mjs';
import { MS_PER_SECOND } from './constants.mjs';
import { withTimeout } from './lock-utils.mjs';
import { withTimeout } from './utils.mjs';
const PROBE_KIND = 27235;
+10
View File
@@ -55,3 +55,13 @@ export function ensureDir(dir) {
export function relayListLabel(relays) {
return relays.join(', ');
}
export function withTimeout(promise, timeoutMs, timeoutMessage = 'Operation timed out') {
let timeoutHandle;
const timeoutPromise = new Promise((_, reject) => {
timeoutHandle = setTimeout(() => reject(new Error(timeoutMessage)), timeoutMs);
});
return Promise.race([promise, timeoutPromise]).finally(() => {
if (timeoutHandle) clearTimeout(timeoutHandle);
});
}
+1 -1
View File
@@ -1,6 +1,6 @@
import { describe, it } from 'node:test';
import assert from 'node:assert';
import { withTimeout } from '../src/lock-utils.mjs';
import { withTimeout } from '../src/utils.mjs';
describe('Async Utilities', () => {
describe('withTimeout', () => {