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

Method #execNext

src/utils/taskManager.js:55–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53 }
54
55 async #execNext() {
56 if (this.#mode === "linear" && this.#busy) {
57 return;
58 }
59
60 const task = this.#queue.shift();
61 if (!task) return;
62
63 let result;
64 let error;
65
66 try {
67 this.#busy = true;
68 const id = this.#count++;
69 result = await task(id);
70 } catch (err) {
71 error = err;
72 } finally {
73 this.#busy = false;
74 }
75
76 this.#listeners.forEach((l) => l(task, result, error));
77 if (this.#mode === "linear") this.#execNext();
78 }
79}

Callers 1

queueTaskMethod · 0.95

Calls 1

lFunction · 0.85

Tested by

no test coverage detected