mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-10-27 04:30:59 +00:00
perf: yield between replayed history messages
A session/load of a long history sent every update from one macrotask when the client read fast enough, starving other sessions and incoming requests. The replay now shares the consumer's 8 ms budget and yields between messages. The updates and their order are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7992,6 +7992,10 @@ export class ClaudeAcpAgent {
|
||||
};
|
||||
|
||||
const replayMessage = async (message: SessionMessage): Promise<void> => {
|
||||
// A long history is sent in order, but with event-loop turns in between,
|
||||
// so other sessions and incoming requests are not starved meanwhile.
|
||||
const pause = messageLoopYielder.maybeYield();
|
||||
if (pause) await pause;
|
||||
if (pending?.stopped || isReplayHiddenMetaMessage(message)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user