MCPcopy
hub / github.com/piscinajs/piscina / ArrayTaskQueue

Class ArrayTaskQueue

src/task_queue/array_queue.ts:5–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import type { TaskQueue, Task } from '.';
4
5export class ArrayTaskQueue implements TaskQueue {
6 tasks: Task[] = []
7
8 get size () {
9 return this.tasks.length;
10 }
11
12 shift (): Task | null {
13 return this.tasks.shift() ?? null;
14 }
15
16 push (task: Task): void {
17 this.tasks.push(task);
18 }
19
20 remove (task: Task): void {
21 const index = this.tasks.indexOf(task);
22 assert.notStrictEqual(index, -1);
23 this.tasks.splice(index, 1);
24 }
25}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected