()
| 861 | } |
| 862 | |
| 863 | async flush(): Promise<void> { |
| 864 | // Cancel pending timer |
| 865 | if (this.flushTimer) { |
| 866 | clearTimeout(this.flushTimer) |
| 867 | this.flushTimer = null |
| 868 | } |
| 869 | // Wait for any in-flight drain to finish |
| 870 | if (this.activeDrain) { |
| 871 | await this.activeDrain |
| 872 | } |
| 873 | // Drain anything remaining in the queues |
| 874 | await this.drainWriteQueue() |
| 875 | |
| 876 | // Wait for non-queue tracked operations (e.g. removeMessageByUuid) |
| 877 | if (this.pendingWriteCount === 0) { |
| 878 | return |
| 879 | } |
| 880 | return new Promise<void>(resolve => { |
| 881 | this.flushResolvers.push(resolve) |
| 882 | }) |
| 883 | } |
| 884 | |
| 885 | /** |
| 886 | * Remove a message from the transcript by UUID. |
no test coverage detected