* @param maxJobs The maximum number of jobs running at the same time * @param maxBytes The maximum total size of the data held by running jobs
(maxJobs: number, maxBytes: number)
| 19 | * @param maxBytes The maximum total size of the data held by running jobs |
| 20 | */ |
| 21 | constructor(maxJobs: number, maxBytes: number) { |
| 22 | this.maxJobs = Math.max(1, maxJobs); |
| 23 | this.maxBytes = maxBytes; |
| 24 | this.failed = new Promise<never>((_resolve, reject) => { |
| 25 | this.rejectFailed = reject; |
| 26 | }); |
| 27 | // The failure is reported to those who wait for it, and by submit and drain |
| 28 | // oxlint-disable-next-line promise/prefer-await-to-then -- only marks the rejection as handled |
| 29 | this.failed.catch(() => {}); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Starts the job as soon as there is capacity. Jobs with the same key never overlap. |
nothing calls this directly
no outgoing calls
no test coverage detected