From 1751cab4663707258f698473d4c4b0f013eda628 Mon Sep 17 00:00:00 2001 From: Long Zhao Date: Mon, 12 Aug 2024 22:48:43 +1000 Subject: [PATCH] fix: only remove the item from the if it is done --- src/CGDGarageDoor.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CGDGarageDoor.ts b/src/CGDGarageDoor.ts index 357169c..bab15c4 100644 --- a/src/CGDGarageDoor.ts +++ b/src/CGDGarageDoor.ts @@ -67,11 +67,12 @@ export class CGDGarageDoor { return; } - const item = this.runQ.shift()!; + const item = this.runQ[0]; try { await item.fn(); } finally { + this.runQ.shift(); this.processRunQ(); } };