chore(deadcode): remove unused main-lane queue wrapper

This commit is contained in:
Vincent Koc
2026-06-22 15:18:05 +08:00
parent c57fee8239
commit f1c6057cd7
2 changed files with 13 additions and 22 deletions
+12 -14
View File
@@ -25,7 +25,6 @@ type CommandQueueModule = typeof import("./command-queue.js");
let clearCommandLane: CommandQueueModule["clearCommandLane"];
let CommandLaneClearedError: CommandQueueModule["CommandLaneClearedError"];
let CommandLaneTaskTimeoutError: CommandQueueModule["CommandLaneTaskTimeoutError"];
let enqueueCommand: CommandQueueModule["enqueueCommand"];
let enqueueCommandInLane: CommandQueueModule["enqueueCommandInLane"];
let GatewayDrainingError: CommandQueueModule["GatewayDrainingError"];
let getActiveTaskCount: CommandQueueModule["getActiveTaskCount"];
@@ -69,7 +68,7 @@ function enqueueBlockedMainTask<T = void>(
release: () => void;
} {
const deferred = createDeferred();
const task = enqueueCommand(async () => {
const task = enqueueCommandInLane(CommandLane.Main, async () => {
await deferred.promise;
return (await onRelease?.()) as T;
});
@@ -98,7 +97,6 @@ describe("command queue", () => {
clearCommandLane,
CommandLaneClearedError,
CommandLaneTaskTimeoutError,
enqueueCommand,
enqueueCommandInLane,
GatewayDrainingError,
getActiveTaskCount,
@@ -152,9 +150,9 @@ describe("command queue", () => {
};
const results = await Promise.all([
enqueueCommand(makeTask(1)),
enqueueCommand(makeTask(2)),
enqueueCommand(makeTask(3)),
enqueueCommandInLane(CommandLane.Main, makeTask(1)),
enqueueCommandInLane(CommandLane.Main, makeTask(2)),
enqueueCommandInLane(CommandLane.Main, makeTask(3)),
]);
expect(results).toEqual([1, 2, 3]);
@@ -271,7 +269,7 @@ describe("command queue", () => {
});
it("logs enqueue depth after push", async () => {
const task = enqueueCommand(async () => {});
const task = enqueueCommandInLane(CommandLane.Main, async () => {});
expect(diagnosticMocks.logLaneEnqueue).toHaveBeenCalledTimes(1);
expect(mockCallArg(diagnosticMocks.logLaneEnqueue, "logLaneEnqueue", 1)).toBe(1);
@@ -286,11 +284,11 @@ describe("command queue", () => {
vi.useFakeTimers();
try {
const blocker = createDeferred();
const first = enqueueCommand(async () => {
const first = enqueueCommandInLane(CommandLane.Main, async () => {
await blocker.promise;
});
const second = enqueueCommand(async () => {}, {
const second = enqueueCommandInLane(CommandLane.Main, async () => {}, {
warnAfterMs: 5,
onWait: (ms, ahead) => {
waited = ms;
@@ -784,7 +782,7 @@ describe("command queue", () => {
const { task: first, release } = enqueueBlockedMainTask(async () => "first");
// Second task is queued behind the first.
const second = enqueueCommand(async () => "second");
const second = enqueueCommandInLane(CommandLane.Main, async () => "second");
const removed = clearCommandLane();
expect(removed).toBe(1); // only the queued (not active) entry
@@ -822,9 +820,9 @@ describe("command queue", () => {
it("rejects new enqueues with GatewayDrainingError after markGatewayDraining", async () => {
markGatewayDraining();
await expect(enqueueCommand(async () => "blocked")).rejects.toBeInstanceOf(
GatewayDrainingError,
);
await expect(
enqueueCommandInLane(CommandLane.Main, async () => "blocked"),
).rejects.toBeInstanceOf(GatewayDrainingError);
});
it("does not affect already-active tasks after markGatewayDraining", async () => {
@@ -837,7 +835,7 @@ describe("command queue", () => {
it("resetAllLanes clears gateway draining flag and re-allows enqueue", async () => {
markGatewayDraining();
resetAllLanes();
await expect(enqueueCommand(async () => "ok")).resolves.toBe("ok");
await expect(enqueueCommandInLane(CommandLane.Main, async () => "ok")).resolves.toBe("ok");
});
it("migrates legacy queue state missing activeTaskWaiters without crashing", async () => {