()
| 654 | } |
| 655 | |
| 656 | private scheduleDrain(): void { |
| 657 | if (this.flushTimer) { |
| 658 | return |
| 659 | } |
| 660 | this.flushTimer = setTimeout(async () => { |
| 661 | this.flushTimer = null |
| 662 | try { |
| 663 | this.activeDrain = this.drainWriteQueue() |
| 664 | await this.activeDrain |
| 665 | } catch (error) { |
| 666 | if (!this.disablePersistenceForError(error, 'session write queue')) { |
| 667 | logError(error) |
| 668 | } |
| 669 | } finally { |
| 670 | this.activeDrain = null |
| 671 | // If more items arrived during drain, schedule again |
| 672 | if (this.writeQueues.size > 0) { |
| 673 | this.scheduleDrain() |
| 674 | } |
| 675 | } |
| 676 | }, this.FLUSH_INTERVAL_MS) |
| 677 | } |
| 678 | |
| 679 | private disablePersistenceForError(error: unknown, context: string): boolean { |
| 680 | if (!isFsInaccessible(error)) { |
no test coverage detected