(taskFunction, that = this, ...args)
| 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) { |
nothing calls this directly
no test coverage detected