| | |
| | | "use strict"; |
| | | |
| | | /** |
| | | * Walks a dynamically expanding async work tree with bounded concurrency. |
| | | * Each processed item may enqueue more items through `push`, allowing callers |
| | | * to model breadth-first or depth-first discovery without managing the queue |
| | | * themselves. |
| | | * @template T |
| | | * @template {Error} E |
| | | * @param {Iterable<T>} items initial items |
| | |
| | | let processScheduled = true; |
| | | |
| | | /** |
| | | * Enqueues a newly discovered item and schedules queue processing when the |
| | | * current concurrency budget allows more work to start. |
| | | * @param {T} item item |
| | | */ |
| | | const push = (item) => { |
| | |
| | | }; |
| | | |
| | | /** |
| | | * Handles completion of a single processor call, propagating the first |
| | | * error and scheduling more queued work when possible. |
| | | * @param {E | null | undefined} err error |
| | | */ |
| | | const processorCallback = (err) => { |