()
| 15 | private running = false; |
| 16 | |
| 17 | private tick() { |
| 18 | if (this.running) { |
| 19 | return; |
| 20 | } |
| 21 | const job = this.jobs.shift(); |
| 22 | if (job) { |
| 23 | this.running = true; |
| 24 | job.promise.resolve( |
| 25 | promiseTry(job.jobFactory, ...job.args).finally(() => { |
| 26 | this.running = false; |
| 27 | this.tick(); |
| 28 | }), |
| 29 | ); |
| 30 | } else { |
| 31 | this.running = false; |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | push<TValue, TArgs extends unknown[]>( |
| 36 | jobFactory: Job<TValue, TArgs>, |