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

Method flush

packages/node-core/src/utils/queues/autoQueue.ts:195–211  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

193 }
194
195 flush(): void {
196 // Empty the queue
197 this.queue.takeAll();
198
199 // Remove reference to runing tasks, they will still continue running but the result wont be used
200 this.runningTasks = [];
201
202 // Set the next task to the index that would be used after flush
203 this.nextTask = this.nextIndex;
204 // Clean up out of order tasks
205 Object.entries(this.outOfOrderTasks).map(([id, task]) => {
206 // Is this desired behaviour? The other option would be resolving undefined
207 task.action.reject(new TaskFlushedError(this.name));
208 });
209 this.outOfOrderTasks = {};
210 this.pendingPromise = false;
211 }
212
213 abort(): void {
214 this._abort = true;

Callers

nothing calls this directly

Calls 2

takeAllMethod · 0.80
mapMethod · 0.80

Tested by

no test coverage detected