perf: speed up memory batch polling

This commit is contained in:
Peter Steinberger
2026-01-18 03:55:09 +00:00
parent 0d9172d761
commit afb877a96b
10 changed files with 62 additions and 10 deletions

View File

@@ -0,0 +1,17 @@
let activeStream: NodeJS.WriteStream | null = null;
export function registerActiveProgressLine(stream: NodeJS.WriteStream): void {
if (!stream.isTTY) return;
activeStream = stream;
}
export function clearActiveProgressLine(): void {
if (!activeStream?.isTTY) return;
activeStream.write("\r\x1b[2K");
}
export function unregisterActiveProgressLine(stream?: NodeJS.WriteStream): void {
if (!activeStream) return;
if (stream && activeStream !== stream) return;
activeStream = null;
}