MCPcopy
hub / github.com/sindresorhus/p-queue / setPriority

Method setPriority

source/priority-queue.ts:50–59  ·  view source on GitHub ↗
(id: string, priority: number)

Source from the content-addressed store, hash-verified

48 }
49
50 setPriority(id: string, priority: number) {
51 // A dequeued item with the same id is no longer part of the queue.
52 const index = this.#queue.findIndex((element: Readonly<PriorityQueueOptions>, index) => index >= this.#head && element.id === id);
53 if (index === -1) {
54 throw new ReferenceError(`No promise function with the id "${id}" exists in the queue.`);
55 }
56
57 const [item] = this.#queue.splice(index, 1);
58 this.enqueue(item!.run, {priority, id});
59 }
60
61 remove(id: string): void;
62 remove(run: RunFunction): void;

Callers

nothing calls this directly

Calls 1

enqueueMethod · 0.95

Tested by

no test coverage detected