MCPcopy Create free account
hub / github.com/alexankitty/Myrient-Search-Engine / enqueue

Method enqueue

lib/utility/taskqueue.js:17–35  ·  view source on GitHub ↗
(taskFunction, that = this, ...args)

Source from the content-addressed store, hash-verified

15 }
16
17 async enqueue(taskFunction, that = this, ...args) {
18 return new Promise((resolve, reject) => {
19 if (this.queue.length >= this.maxQueueLength) {
20 reject(new Error("Queue is full. Maximum queue size exceeded."));
21 return;
22 }
23 this.queue.push({
24 taskFunction,
25 that,
26 args,
27 resolve,
28 reject,
29 });
30
31 if (!this.processing) {
32 this.processQueue();
33 }
34 });
35 }
36
37 async processQueue() {
38 if (this.processing || this.queue.length === 0) {

Callers

nothing calls this directly

Calls 1

processQueueMethod · 0.95

Tested by

no test coverage detected