mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 11:52:55 +00:00
chore(lint): enable no-promise-executor-return
This commit is contained in:
@@ -242,7 +242,9 @@ function resolveSetupTokenSource(): TokenSource {
|
||||
}
|
||||
|
||||
async function sleep(ms: number): Promise<void> {
|
||||
return await new Promise((resolve) => setTimeout(resolve, ms));
|
||||
return await new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
async function withTimeout<T>(
|
||||
@@ -493,7 +495,9 @@ async function startGatewayProcess(params: {
|
||||
child.kill("SIGINT");
|
||||
}
|
||||
const exited = await withTimeout(
|
||||
new Promise<boolean>((resolve) => child.once("exit", () => resolve(true))),
|
||||
new Promise<boolean>((resolve) => {
|
||||
child.once("exit", () => resolve(true));
|
||||
}),
|
||||
1_500,
|
||||
() => false,
|
||||
);
|
||||
|
||||
@@ -298,7 +298,9 @@ function runCheckedCommand(command, args) {
|
||||
}
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
function parsePsCpuTimeMs(timeText) {
|
||||
|
||||
@@ -222,7 +222,9 @@ function logStep(message) {
|
||||
}
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
async function getFreePort() {
|
||||
|
||||
@@ -601,7 +601,9 @@ function buildBatchPrompt(items: readonly TranslationBatchItem[]): string {
|
||||
}
|
||||
|
||||
function sleep(ms: number) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
function formatDuration(ms: number): string {
|
||||
|
||||
@@ -140,7 +140,9 @@ const DISCORD_RESPONSE_BODY_MAX_BYTES = 1024 * 1024;
|
||||
const WEBHOOK_CLEANUP_TIMEOUT_MS = 10_000;
|
||||
|
||||
function sleep(ms: number): Promise<void> {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
function remainingTimeoutMs(deadlineMs: number, nowMs = Date.now()): number {
|
||||
|
||||
@@ -145,7 +145,9 @@ async function main() {
|
||||
const waitSeconds = Number.parseInt(getArg("--wait-seconds") ?? "25", 10);
|
||||
const deadline = Date.now() + Math.max(1, waitSeconds) * 1000;
|
||||
while (!node && Date.now() < deadline) {
|
||||
await new Promise((r) => setTimeout(r, 1000));
|
||||
await new Promise((r) => {
|
||||
setTimeout(r, 1000);
|
||||
});
|
||||
const res = await request("node.list").catch(() => null);
|
||||
if (!res?.ok) {
|
||||
continue;
|
||||
|
||||
@@ -54,7 +54,9 @@ function parseOptions(args = process.argv.slice(2)): Options {
|
||||
}
|
||||
|
||||
function delay(ms: number): Promise<void> {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
function shouldUseAltScreen(options: Options) {
|
||||
|
||||
@@ -713,7 +713,9 @@ export async function stopGateway(child, options = {}) {
|
||||
}
|
||||
const teardownGraceMs = Math.max(0, options.teardownGraceMs ?? GATEWAY_TEARDOWN_GRACE_MS);
|
||||
const killGraceMs = Math.max(0, options.killGraceMs ?? GATEWAY_TEARDOWN_KILL_GRACE_MS);
|
||||
const exited = new Promise((resolve) => child.once("exit", resolve));
|
||||
const exited = new Promise((resolve) => {
|
||||
child.once("exit", resolve);
|
||||
});
|
||||
const waitForExit = async (ms) =>
|
||||
hasChildExited(child)
|
||||
? true
|
||||
|
||||
@@ -5,7 +5,10 @@ const logPath = process.env.OPENCLAW_CONFIG_RELOAD_LOG_PATH ?? "/tmp/config-relo
|
||||
const deadlineMs = Date.now() + readPositiveIntEnv("OPENCLAW_CONFIG_RELOAD_LOG_TIMEOUT_MS", 30_000);
|
||||
const maxReadBytes = readPositiveIntEnv("OPENCLAW_CONFIG_RELOAD_LOG_MAX_READ_BYTES", 256 * 1024);
|
||||
|
||||
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
const sleep = (ms) =>
|
||||
new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
const scanner = createConfigReloadLogScanner(logPath, {
|
||||
maxReadBytes,
|
||||
tailLineLimit: 160,
|
||||
|
||||
@@ -12,7 +12,9 @@ if (!url || !token) {
|
||||
const deadline = Date.now() + readGatewayNetworkClientConnectTimeoutMs();
|
||||
|
||||
function delay(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
async function openSocket(timeoutMs = 10_000) {
|
||||
@@ -90,10 +92,7 @@ while (Date.now() < deadline) {
|
||||
}
|
||||
} else {
|
||||
ws.send(JSON.stringify({ type: "req", id: "h1", method: "health" }));
|
||||
const healthRes = await onceFrame(
|
||||
ws,
|
||||
(frame) => frame?.type === "res" && frame?.id === "h1",
|
||||
);
|
||||
const healthRes = await onceFrame(ws, (frame) => frame?.type === "res" && frame?.id === "h1");
|
||||
if (healthRes.ok) {
|
||||
ws.close();
|
||||
console.log("ok");
|
||||
|
||||
@@ -71,7 +71,9 @@ async function waitRegistry() {
|
||||
if (await registryHealthy()) {
|
||||
return;
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 100);
|
||||
});
|
||||
}
|
||||
throw new Error("Local npm metadata registry failed to start");
|
||||
}
|
||||
@@ -172,10 +174,7 @@ function assertCorruptPluginDetails(plugins, pluginId) {
|
||||
const evidence = collectPluginEvidence(plugins, pluginId);
|
||||
const outcome = evidence.outcome;
|
||||
const disabledAfterFailure = isCorruptPluginDisabledAfterUpdate(evidence, pluginId);
|
||||
if (
|
||||
!outcome ||
|
||||
(outcome.status !== "error" && !disabledAfterFailure)
|
||||
) {
|
||||
if (!outcome || (outcome.status !== "error" && !disabledAfterFailure)) {
|
||||
throw new Error(
|
||||
`expected error or disabled-after-failure outcome for ${pluginId}, got ${JSON.stringify({
|
||||
outcomes: plugins.npm?.outcomes ?? [],
|
||||
|
||||
@@ -289,7 +289,9 @@ async function waitClickClackSocket() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 250));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 250);
|
||||
});
|
||||
}
|
||||
throw new Error(`Timed out waiting for ClickClack websocket connection at ${baseUrl}`);
|
||||
}
|
||||
@@ -315,7 +317,9 @@ async function waitClickClackReply() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 250));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 250);
|
||||
});
|
||||
}
|
||||
const state = fs.existsSync(statePath) ? fs.readFileSync(statePath, "utf8") : "<missing>";
|
||||
throw new Error(`Timed out waiting for ClickClack reply marker ${marker}. State: ${state}`);
|
||||
|
||||
@@ -169,7 +169,9 @@ while (Date.now() - startedAt <= timeoutMs) {
|
||||
} catch (error) {
|
||||
lastError = error instanceof Error ? error.message : String(error);
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 500);
|
||||
});
|
||||
}
|
||||
|
||||
const suffix = lastResult ? ` (last HTTP ${lastResult.status}: ${lastResult.text})` : "";
|
||||
|
||||
@@ -396,7 +396,9 @@ async function acquireWithRetry(config) {
|
||||
"ETIMEDOUT",
|
||||
);
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, delayMs);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -451,7 +453,9 @@ async function heartbeat(opts) {
|
||||
config.heartbeatIntervalMs,
|
||||
"heartbeatIntervalMs",
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, intervalMs);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,9 @@ const observedMessages = [];
|
||||
let driverUpdateOffset = 0;
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
function messageText(message) {
|
||||
|
||||
@@ -36,7 +36,9 @@ function timeoutBefore(deadline: number, fallbackMs: number): number {
|
||||
}
|
||||
|
||||
function sleep(ms: number): Promise<void> {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
function throwIfFailed(label: string, result: CommandResult, check: boolean | undefined): void {
|
||||
|
||||
@@ -121,7 +121,9 @@ async function waitForHostServer(
|
||||
if (await canConnect(port)) {
|
||||
return;
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 100);
|
||||
});
|
||||
}
|
||||
child.kill("SIGTERM");
|
||||
die(`host artifact server did not start on port ${port}: ${stderr.trim()}`);
|
||||
@@ -151,7 +153,9 @@ async function canConnect(port: number): Promise<boolean> {
|
||||
}
|
||||
|
||||
async function delay(ms: number): Promise<void> {
|
||||
await new Promise((resolve) => setTimeout(resolve, ms));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
export const testing = {
|
||||
|
||||
@@ -666,7 +666,9 @@ class NpmUpdateSmoke {
|
||||
private async monitorJobs(label: string, jobs: Job[]): Promise<void> {
|
||||
const pending = new Set(jobs.map((job) => job.label));
|
||||
while (pending.size > 0) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 15_000));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 15_000);
|
||||
});
|
||||
for (const job of jobs) {
|
||||
if (!pending.has(job.label)) {
|
||||
continue;
|
||||
|
||||
@@ -283,5 +283,7 @@ function isErrorCode(error: unknown, code: string): boolean {
|
||||
}
|
||||
|
||||
async function delay(ms: number): Promise<void> {
|
||||
await new Promise((resolve) => setTimeout(resolve, ms));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -270,9 +270,9 @@ async function allocatePort() {
|
||||
});
|
||||
const address = server.address();
|
||||
const port = typeof address === "object" && address ? address.port : 0;
|
||||
await new Promise((resolve, reject) =>
|
||||
server.close((error) => (error ? reject(error) : resolve())),
|
||||
);
|
||||
await new Promise((resolve, reject) => {
|
||||
server.close((error) => (error ? reject(error) : resolve()));
|
||||
});
|
||||
if (!port) {
|
||||
throw new Error("failed to allocate a local port");
|
||||
}
|
||||
@@ -556,15 +556,7 @@ function serviceManagerEnv(source) {
|
||||
|
||||
async function startGateway(envCtx, port, token = TOKEN_V1) {
|
||||
const command = await resolveOpenClawCommand(
|
||||
[
|
||||
"gateway",
|
||||
"run",
|
||||
"--port",
|
||||
String(port),
|
||||
"--bind",
|
||||
"loopback",
|
||||
"--allow-unconfigured",
|
||||
],
|
||||
["gateway", "run", "--port", String(port), "--bind", "loopback", "--allow-unconfigured"],
|
||||
envCtx.env,
|
||||
{
|
||||
detached: process.platform !== "win32",
|
||||
@@ -725,15 +717,7 @@ async function expectReloadMayCloseForAuthChange(env, port, token) {
|
||||
|
||||
async function expectGatewayStartupFails(envCtx, port, reason) {
|
||||
const command = await resolveOpenClawCommand(
|
||||
[
|
||||
"gateway",
|
||||
"run",
|
||||
"--port",
|
||||
String(port),
|
||||
"--bind",
|
||||
"loopback",
|
||||
"--allow-unconfigured",
|
||||
],
|
||||
["gateway", "run", "--port", String(port), "--bind", "loopback", "--allow-unconfigured"],
|
||||
envCtx.env,
|
||||
{
|
||||
detached: process.platform !== "win32",
|
||||
@@ -1344,28 +1328,16 @@ async function p12OpenAiLiveProof() {
|
||||
async function runPtySecretsConfigurePreset(envCtx) {
|
||||
const { spawn } = await import("@lydell/node-pty");
|
||||
const command = await resolveOpenClawCommand(
|
||||
[
|
||||
"secrets",
|
||||
"configure",
|
||||
"--providers-only",
|
||||
"--apply",
|
||||
"--yes",
|
||||
"--allow-exec",
|
||||
"--json",
|
||||
],
|
||||
["secrets", "configure", "--providers-only", "--apply", "--yes", "--allow-exec", "--json"],
|
||||
envCtx.env,
|
||||
);
|
||||
const child = spawn(
|
||||
command.command,
|
||||
command.args,
|
||||
{
|
||||
name: "xterm-256color",
|
||||
cols: 100,
|
||||
rows: 30,
|
||||
cwd: command.options.cwd ?? process.cwd(),
|
||||
env: command.options.env ?? envCtx.env,
|
||||
},
|
||||
);
|
||||
const child = spawn(command.command, command.args, {
|
||||
name: "xterm-256color",
|
||||
cols: 100,
|
||||
rows: 30,
|
||||
cwd: command.options.cwd ?? process.cwd(),
|
||||
env: command.options.env ?? envCtx.env,
|
||||
});
|
||||
let output = "";
|
||||
let phase = "providers-menu";
|
||||
const sendKeys = (keys) => {
|
||||
|
||||
@@ -786,7 +786,9 @@ export async function waitForLog(
|
||||
if (pattern.test(text)) {
|
||||
return;
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 500);
|
||||
});
|
||||
}
|
||||
const text = readLogTail(logPath);
|
||||
throw new Error(`${label} did not become ready within ${timeoutMs}ms\n${text.slice(-4000)}`);
|
||||
@@ -1220,7 +1222,9 @@ async function runRemoteCommand(params: {
|
||||
if (attempt === 4 || !isTransientSshFailure(error)) {
|
||||
throw error;
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, attempt * 3000));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, attempt * 3000);
|
||||
});
|
||||
}
|
||||
}
|
||||
throw lastError;
|
||||
@@ -2425,9 +2429,13 @@ async function main() {
|
||||
],
|
||||
{ cwd: root, stdio: "inherit" },
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 3_000));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 3_000);
|
||||
});
|
||||
await sshRun(root, inspect, `bash ${REMOTE_ROOT}/remote-probe.sh`);
|
||||
const recordCode = await new Promise<number | null>((resolve) => recording.on("exit", resolve));
|
||||
const recordCode = await new Promise<number | null>((resolve) => {
|
||||
recording.on("exit", resolve);
|
||||
});
|
||||
if (recordCode !== 0) {
|
||||
throw new Error(`Crabbox recording failed with exit code ${recordCode ?? "unknown"}.`);
|
||||
}
|
||||
|
||||
@@ -257,10 +257,14 @@ function runOnce(mode: Mode, scopeBytes: number, iter: number): void {
|
||||
|
||||
async function settleAndGc(): Promise<void> {
|
||||
for (let i = 0; i < 4; i += 1) {
|
||||
await new Promise<void>((r) => setImmediate(r));
|
||||
await new Promise<void>((r) => {
|
||||
setImmediate(r);
|
||||
});
|
||||
globalThis.gc?.();
|
||||
}
|
||||
await new Promise<void>((r) => setTimeout(r, 100));
|
||||
await new Promise<void>((r) => {
|
||||
setTimeout(r, 100);
|
||||
});
|
||||
globalThis.gc?.();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,9 @@ export type StopChildResult = ChildExit & {
|
||||
};
|
||||
|
||||
export function delay(ms: number): Promise<void> {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
export async function stopChild(
|
||||
@@ -40,7 +42,9 @@ export async function stopChild(
|
||||
const waitForExit = async (ms: number): Promise<ChildExit | null> =>
|
||||
await Promise.race([exited, delay(ms).then(() => null)]);
|
||||
|
||||
await new Promise<void>((resolve) => setImmediate(resolve));
|
||||
await new Promise<void>((resolve) => {
|
||||
setImmediate(resolve);
|
||||
});
|
||||
const queuedExit = observedExit ?? currentExit();
|
||||
if (queuedExit != null) {
|
||||
return { ...queuedExit, exitedBeforeTeardown: true };
|
||||
|
||||
@@ -224,7 +224,9 @@ async function fetchWithRetry(
|
||||
lastError = error;
|
||||
}
|
||||
if (attempt < attempts) {
|
||||
await new Promise((resolveDelay) => setTimeout(resolveDelay, attempt * 1000));
|
||||
await new Promise((resolveDelay) => {
|
||||
setTimeout(resolveDelay, attempt * 1000);
|
||||
});
|
||||
}
|
||||
}
|
||||
const message = lastError instanceof Error ? lastError.message : String(lastError);
|
||||
|
||||
@@ -3968,7 +3968,9 @@ function formatError(error) {
|
||||
}
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise((resolvePromise) => setTimeout(resolvePromise, ms));
|
||||
return new Promise((resolvePromise) => {
|
||||
setTimeout(resolvePromise, ms);
|
||||
});
|
||||
}
|
||||
|
||||
async function withAllocatedGatewayPort(lane, callback) {
|
||||
|
||||
@@ -835,7 +835,9 @@ async function waitForLocalPort(port: number, timeoutMs: number, readFailure: ()
|
||||
if (failure) {
|
||||
throw new Error(failure);
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 500);
|
||||
});
|
||||
}
|
||||
throw new Error(`timed out waiting for OpenTelemetry Collector on 127.0.0.1:${port}`);
|
||||
}
|
||||
@@ -1045,7 +1047,9 @@ function isLatestGenAiModelCallSpan(span: CapturedSpan): boolean {
|
||||
}
|
||||
|
||||
async function delay(ms: number): Promise<void> {
|
||||
await new Promise((resolve) => setTimeout(resolve, ms));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
function hasRequiredSmokeSignals(receiver: ReturnType<typeof startLocalOtlpReceiver>): boolean {
|
||||
|
||||
@@ -305,7 +305,9 @@ async function findDispatchedWorkflowRunId(params: {
|
||||
if (runId) {
|
||||
return runId;
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 5_000));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 5_000);
|
||||
});
|
||||
}
|
||||
throw new Error(`could not find dispatched run for ${params.workflow}`);
|
||||
}
|
||||
@@ -355,7 +357,11 @@ export async function pollRun(
|
||||
const timeoutMs = Math.max(1, options.timeoutMs ?? TELEGRAM_POLL_TIMEOUT_MS);
|
||||
const pollIntervalMs = Math.max(1, options.pollIntervalMs ?? TELEGRAM_POLL_INTERVAL_MS);
|
||||
const sleep =
|
||||
options.sleep ?? ((ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms)));
|
||||
options.sleep ??
|
||||
((ms: number) =>
|
||||
new Promise<void>((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
}));
|
||||
const readRun =
|
||||
options.readRun ??
|
||||
((currentRepo: string, currentRunId: string) =>
|
||||
|
||||
@@ -288,7 +288,9 @@ export function parseRunIdFromDispatchOutput(output) {
|
||||
}
|
||||
|
||||
async function wait(ms) {
|
||||
await new Promise((resolve) => setTimeout(resolve, ms));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
async function findNewRunId(repo, workflowFile, workflowName, beforeIds) {
|
||||
|
||||
@@ -667,7 +667,10 @@ const parsePositiveIntegerEnv = (env, name, fallback) => {
|
||||
return Number.isInteger(parsed) && parsed > 0 ? parsed : fallback;
|
||||
};
|
||||
|
||||
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
const sleep = (ms) =>
|
||||
new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
|
||||
const resolveRunNodeOutputLogPath = (deps) => {
|
||||
const outputLog = deps.env[RUN_NODE_OUTPUT_LOG_ENV]?.trim();
|
||||
|
||||
@@ -230,7 +230,9 @@ function npmViewReadme(spec) {
|
||||
}
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
export function readPositiveIntEnv(name, fallback, env = process.env) {
|
||||
|
||||
@@ -92,7 +92,10 @@ const isProcessAlive = (pid, signalProcess) => {
|
||||
return true;
|
||||
};
|
||||
|
||||
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
const sleep = (ms) =>
|
||||
new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
|
||||
const createWatchLockKey = (cwd, args) =>
|
||||
createHash("sha256").update(cwd).update("\0").update(args.join("\0")).digest("hex").slice(0, 12);
|
||||
|
||||
@@ -48,12 +48,16 @@ const findRunnerCandidates = () =>
|
||||
// Retry briefly to avoid flaky builds.
|
||||
let candidates = findCandidates();
|
||||
for (let i = 0; i < 10 && candidates.length === 0; i++) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 50));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 50);
|
||||
});
|
||||
candidates = findCandidates();
|
||||
}
|
||||
let runnerCandidates = findRunnerCandidates();
|
||||
for (let i = 0; i < 10 && runnerCandidates.length === 0; i++) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 50));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 50);
|
||||
});
|
||||
runnerCandidates = findRunnerCandidates();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user