Reduce daemon churn from terminals and archived agents
Decouple terminal list snapshots from workspace status invalidation, and filter archived stored agents before projection so seeded homes do less work.
This commit is contained in:
@@ -188,14 +188,6 @@ function watchTerminal(session: TerminalSession): void {
|
||||
]);
|
||||
}
|
||||
|
||||
manager.subscribeTerminalsChanged((event) => {
|
||||
sendToParent({
|
||||
type: "terminalsChanged",
|
||||
cwd: event.cwd,
|
||||
terminals: event.terminals,
|
||||
});
|
||||
});
|
||||
|
||||
function enqueueCreateTerminalRequest(message: TerminalCreateRequest): Promise<void> {
|
||||
const nextRequest = createTerminalQueue.then(() => handleCreateTerminalRequest(message));
|
||||
createTerminalQueue = nextRequest.catch(() => {});
|
||||
@@ -265,33 +257,17 @@ async function handleRequest(message: TerminalWorkerRequest): Promise<void> {
|
||||
}
|
||||
|
||||
case "killTerminal": {
|
||||
const session = manager.getTerminal(message.terminalId);
|
||||
const cwd = session?.cwd;
|
||||
manager.killTerminal(message.terminalId);
|
||||
// Removal is owned by session.onExit -> terminalExit; the parent mirror
|
||||
// clears contribution and emits terminalsChanged from that single path.
|
||||
clearTerminalSubscriptions(message.terminalId);
|
||||
if (cwd) {
|
||||
sendToParent({
|
||||
type: "terminalRemoved",
|
||||
terminalId: message.terminalId,
|
||||
cwd,
|
||||
});
|
||||
}
|
||||
sendToParent({ type: "response", requestId: message.requestId, ok: true });
|
||||
return;
|
||||
}
|
||||
|
||||
case "killTerminalAndWait": {
|
||||
const session = manager.getTerminal(message.terminalId);
|
||||
const cwd = session?.cwd;
|
||||
await manager.killTerminalAndWait(message.terminalId, message.options);
|
||||
clearTerminalSubscriptions(message.terminalId);
|
||||
if (cwd) {
|
||||
sendToParent({
|
||||
type: "terminalRemoved",
|
||||
terminalId: message.terminalId,
|
||||
cwd,
|
||||
});
|
||||
}
|
||||
sendToParent({ type: "response", requestId: message.requestId, ok: true });
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user