MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / queueTask

Method queueTask

src/utils/taskManager.js:38–53  ·  view source on GitHub ↗

* Add task to queue * @param {()=>Promise} task

(task)

Source from the content-addressed store, hash-verified

36 * @param {()=>Promise} task
37 */
38 async queueTask(task) {
39 this.#queue.push(task);
40 this.#execNext();
41 return new Promise((resolve, reject) => {
42 const listener = (t, result, error) => {
43 if (t !== task) return;
44
45 this.#listeners = this.#listeners.filter((l) => l !== listener);
46
47 if (error) reject(error);
48 else resolve(result);
49 };
50
51 this.#listeners.push(listener);
52 });
53 }
54
55 async #execNext() {
56 if (this.#mode === "linear" && this.#busy) {

Callers

nothing calls this directly

Calls 1

#execNextMethod · 0.95

Tested by

no test coverage detected