mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(system-agent): clear passive poll timer portably
This commit is contained in:
@@ -229,16 +229,15 @@ export class SystemAgentChatEngine {
|
||||
return reply;
|
||||
});
|
||||
this.turnQueue = observation.catch(() => undefined);
|
||||
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||
let cancelTimer: (() => void) | undefined;
|
||||
const outcome = await Promise.race([
|
||||
observation.then((reply) => ({ reply })),
|
||||
new Promise<undefined>((resolve) => {
|
||||
timer = setTimeout(resolve, 0);
|
||||
const timer = setTimeout(resolve, 0);
|
||||
cancelTimer = () => clearTimeout(timer);
|
||||
}),
|
||||
]);
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
cancelTimer?.();
|
||||
if (outcome) {
|
||||
if (
|
||||
outcome.reply.text &&
|
||||
|
||||
Reference in New Issue
Block a user