()
| 616 | } |
| 617 | |
| 618 | private scheduleDrain(): void { |
| 619 | if (this.flushTimer) { |
| 620 | return |
| 621 | } |
| 622 | this.flushTimer = setTimeout(async () => { |
| 623 | this.flushTimer = null |
| 624 | this.activeDrain = this.drainWriteQueue() |
| 625 | await this.activeDrain |
| 626 | this.activeDrain = null |
| 627 | // If more items arrived during drain, schedule again |
| 628 | if (this.writeQueues.size > 0) { |
| 629 | this.scheduleDrain() |
| 630 | } |
| 631 | }, this.FLUSH_INTERVAL_MS) |
| 632 | } |
| 633 | |
| 634 | private async appendToFile(filePath: string, data: string): Promise<void> { |
| 635 | try { |
no test coverage detected