(filePath: string, entry: Entry)
| 611 | } |
| 612 | |
| 613 | private enqueueWrite(filePath: string, entry: Entry): Promise<void> { |
| 614 | return new Promise<void>(resolve => { |
| 615 | let queue = this.writeQueues.get(filePath) |
| 616 | if (!queue) { |
| 617 | queue = [] |
| 618 | this.writeQueues.set(filePath, queue) |
| 619 | } |
| 620 | // Drop oldest entries when queue exceeds limit to prevent unbounded memory growth |
| 621 | if (queue.length >= 1000) { |
| 622 | const dropped = queue.splice(0, queue.length - 999) |
| 623 | for (const d of dropped) { |
| 624 | d.resolve() |
| 625 | } |
| 626 | } |
| 627 | queue.push({ entry, resolve }) |
| 628 | this.scheduleDrain() |
| 629 | }) |
| 630 | } |
| 631 | |
| 632 | private scheduleDrain(): void { |
| 633 | if (this.flushTimer) { |
no test coverage detected