* Drain and execute all queued post-stream actions
()
| 1308 | * Drain and execute all queued post-stream actions |
| 1309 | */ |
| 1310 | private async drainPostStreamActions(): Promise<void> { |
| 1311 | if (this.draining) return |
| 1312 | this.draining = true |
| 1313 | try { |
| 1314 | let action: (() => Promise<void>) | undefined |
| 1315 | while ((action = this.postStreamActions.shift()) !== undefined) { |
| 1316 | await action() |
| 1317 | } |
| 1318 | } finally { |
| 1319 | this.draining = false |
| 1320 | } |
| 1321 | } |
| 1322 | |
| 1323 | /** |
| 1324 | * Check if we should continue the flow and do so if needed |