fix(process): reject pending promises when clearing command lane
clearCommandLane() was truncating the queue array without calling resolve/reject on pending entries, causing never-settling promises and memory leaks when upstream callers await enqueueCommandInLane(). Splice entries and reject each before clearing so callers can handle the cancellation gracefully.
This commit is contained in:
committed by
Peter Steinberger
parent
f7e2b8ff5f
commit
a49dd83b14
@@ -162,7 +162,10 @@ export function clearCommandLane(lane: string = CommandLane.Main) {
|
||||
return 0;
|
||||
}
|
||||
const removed = state.queue.length;
|
||||
state.queue.length = 0;
|
||||
const pending = state.queue.splice(0);
|
||||
for (const entry of pending) {
|
||||
entry.reject(new Error("Command lane cleared"));
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user