mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 02:06:43 +00:00
test: tighten async polling intervals (#108301)
This commit is contained in:
@@ -77,7 +77,7 @@ async function waitForRuntimeOutput(
|
||||
throw new Error(`Timed out waiting for output containing ${pattern}`);
|
||||
}
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 25);
|
||||
setTimeout(resolve, 5);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ async function waitForProcessExit(pid: number, timeoutMs = 2_000): Promise<boole
|
||||
return true;
|
||||
}
|
||||
await new Promise<void>((resolve) => {
|
||||
setTimeout(resolve, 25);
|
||||
setTimeout(resolve, 5);
|
||||
});
|
||||
}
|
||||
return !isProcessAlive(pid);
|
||||
|
||||
@@ -88,7 +88,7 @@ async function waitForJsonFile<T>(filePath: string, timeoutMs: number): Promise<
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 25);
|
||||
setTimeout(resolve, 5);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ async function waitForCondition(predicate: () => boolean, timeoutMs = 5_000): Pr
|
||||
return;
|
||||
}
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 50);
|
||||
setTimeout(resolve, 10);
|
||||
});
|
||||
}
|
||||
throw new Error("timed out waiting for condition");
|
||||
|
||||
@@ -194,7 +194,7 @@ async function waitFor(condition: () => boolean, timeoutMs = 3_000) {
|
||||
throw new Error("timed out waiting for condition");
|
||||
}
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 25);
|
||||
setTimeout(resolve, 5);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ async function waitFor(predicate: () => boolean, timeoutMs = 5000) {
|
||||
if (predicate()) {
|
||||
return true;
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 25));
|
||||
await new Promise((resolve) => setTimeout(resolve, 5));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ async function waitFor(predicate: () => boolean, timeoutMs: number): Promise<boo
|
||||
if (predicate()) {
|
||||
return true;
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 50));
|
||||
await new Promise((resolve) => setTimeout(resolve, 10));
|
||||
}
|
||||
return predicate();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ async function waitForCondition(predicate: () => boolean, timeoutMs = 5_000): Pr
|
||||
return;
|
||||
}
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 50);
|
||||
setTimeout(resolve, 10);
|
||||
});
|
||||
}
|
||||
throw new Error("timed out waiting for condition");
|
||||
|
||||
@@ -43,7 +43,7 @@ async function waitFor(predicate: () => boolean, label: string, timeoutMs = 3_00
|
||||
throw new Error(`timed out waiting for ${label}`);
|
||||
}
|
||||
await new Promise<void>((resolve) => {
|
||||
setTimeout(resolve, 25);
|
||||
setTimeout(resolve, 5);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ async function waitFor(predicate: () => boolean, timeoutMs = 5_000): Promise<voi
|
||||
return;
|
||||
}
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 25);
|
||||
setTimeout(resolve, 5);
|
||||
});
|
||||
}
|
||||
throw new Error("condition was not met before timeout");
|
||||
|
||||
@@ -46,7 +46,7 @@ async function waitForFile(filePath: string, timeoutMs: number): Promise<void> {
|
||||
return;
|
||||
}
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 25);
|
||||
setTimeout(resolve, 5);
|
||||
});
|
||||
}
|
||||
throw new Error(`timeout waiting for ${filePath}`);
|
||||
@@ -59,7 +59,7 @@ async function waitForDead(pid: number, timeoutMs: number): Promise<void> {
|
||||
return;
|
||||
}
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 25);
|
||||
setTimeout(resolve, 5);
|
||||
});
|
||||
}
|
||||
throw new Error(`process still alive: ${pid}`);
|
||||
|
||||
@@ -53,7 +53,7 @@ async function waitForFile(filePath: string, timeoutMs: number): Promise<void> {
|
||||
if (fs.existsSync(filePath)) {
|
||||
return;
|
||||
}
|
||||
await sleep(25);
|
||||
await sleep(5);
|
||||
}
|
||||
throw new Error(`timed out waiting for ${filePath}`);
|
||||
}
|
||||
@@ -64,7 +64,7 @@ async function waitForDead(pid: number, timeoutMs: number): Promise<void> {
|
||||
if (!isProcessAlive(pid)) {
|
||||
return;
|
||||
}
|
||||
await sleep(25);
|
||||
await sleep(5);
|
||||
}
|
||||
throw new Error(`timed out waiting for pid ${pid} to exit`);
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ async function waitForCondition(
|
||||
if (predicate()) {
|
||||
return;
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 25));
|
||||
await new Promise((resolve) => setTimeout(resolve, 5));
|
||||
}
|
||||
throw new Error(`timed out waiting for ${label}`);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ async function waitFor(predicate: () => boolean, label: string, timeoutMs = 3_00
|
||||
throw new Error(`timed out waiting for ${label}`);
|
||||
}
|
||||
await new Promise<void>((resolve) => {
|
||||
setTimeout(resolve, 25);
|
||||
setTimeout(resolve, 5);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user