mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 16:43:43 +00:00
fix(discord): prevent stuck typing indicator
This commit is contained in:
committed by
Nimrod Gutman
parent
fb76e316fb
commit
a0fa283839
@@ -85,4 +85,28 @@ describe("createTypingCallbacks", () => {
|
||||
|
||||
expect(stop).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("does not restart keepalive after idle cleanup", async () => {
|
||||
vi.useFakeTimers();
|
||||
try {
|
||||
const start = vi.fn().mockResolvedValue(undefined);
|
||||
const stop = vi.fn().mockResolvedValue(undefined);
|
||||
const onStartError = vi.fn();
|
||||
const callbacks = createTypingCallbacks({ start, stop, onStartError });
|
||||
|
||||
await callbacks.onReplyStart();
|
||||
expect(start).toHaveBeenCalledTimes(1);
|
||||
|
||||
callbacks.onIdle?.();
|
||||
await flushMicrotasks();
|
||||
|
||||
await callbacks.onReplyStart();
|
||||
await vi.advanceTimersByTimeAsync(9_000);
|
||||
|
||||
expect(start).toHaveBeenCalledTimes(1);
|
||||
expect(stop).toHaveBeenCalledTimes(1);
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user