From 686f0d8e21efc1cae0b4c855d6a1eab58258d436 Mon Sep 17 00:00:00 2001 From: Raishav Hanspal Date: Fri, 19 Jul 2024 07:38:37 +0530 Subject: [PATCH] #208 - use enqueue function in setPriority --- source/priority-queue.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/source/priority-queue.ts b/source/priority-queue.ts index dd427ea..cc46b88 100644 --- a/source/priority-queue.ts +++ b/source/priority-queue.ts @@ -44,18 +44,7 @@ export default class PriorityQueue implements Queue= priority) { - this.#queue.push(item); - return; - } - - const index = lowerBound( - this.#queue, item, - (a: Readonly, b: Readonly) => b.priority! - a.priority!, - ); - - this.#queue.splice(index, 0, item); + this.enqueue(item.run, {priority, id}); } dequeue(): RunFunction | undefined {