mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 21:20:44 +00:00
test: clear ollama stream timeout guard
This commit is contained in:
@@ -1237,12 +1237,19 @@ async function nextEventWithin<T>(
|
||||
iterator: AsyncIterator<T>,
|
||||
timeoutMs = 100,
|
||||
): Promise<IteratorResult<T> | "timeout"> {
|
||||
return await Promise.race([
|
||||
iterator.next(),
|
||||
new Promise<"timeout">((resolve) => {
|
||||
setTimeout(() => resolve("timeout"), timeoutMs);
|
||||
}),
|
||||
]);
|
||||
let timer: NodeJS.Timeout | undefined;
|
||||
try {
|
||||
return await Promise.race([
|
||||
iterator.next(),
|
||||
new Promise<"timeout">((resolve) => {
|
||||
timer = setTimeout(() => resolve("timeout"), timeoutMs);
|
||||
}),
|
||||
]);
|
||||
} finally {
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
describe("createOllamaStreamFn streaming events", () => {
|
||||
|
||||
Reference in New Issue
Block a user