MCPcopy Create free account
hub / github.com/subquery/subql / putMany

Method putMany

packages/node-core/src/utils/queues/autoQueue.ts:92–109  ·  view source on GitHub ↗
(tasks: Array<Task<T>>)

Source from the content-addressed store, hash-verified

90
91 // eslint-disable-next-line @typescript-eslint/promise-function-async
92 putMany(tasks: Array<Task<T>>): Promise<T>[] {
93 if (this.freeSpace && tasks.length > this.freeSpace) {
94 throw new Error(`${this.name} Queue exceeds max size of ${this.capacity}`);
95 }
96
97 if (this._abort) {
98 throw new Error(`${this.name} Queue has been aborted`);
99 }
100
101 return tasks.map((task, index) => {
102 return new Promise((resolve, reject) => {
103 this.queue.put({task, resolve, reject, index: this.nextIndex++});
104 if (tasks.length - 1 === index) {
105 void this.take();
106 }
107 });
108 });
109 }
110
111 private processOutOfOrderTasks() {
112 // If already processing, let the existing call handle it.

Callers 1

putMethod · 0.95

Calls 3

takeMethod · 0.95
mapMethod · 0.80
putMethod · 0.45

Tested by

no test coverage detected