| 811 | } |
| 812 | |
| 813 | private flushEventBuffer() { |
| 814 | this.flushTimeout = null; |
| 815 | const buffer = this.eventBuffer; |
| 816 | this.eventBuffer = []; |
| 817 | |
| 818 | // Re-lookup: subscriptions removed during batch window are intentionally skipped. |
| 819 | for (const { subId, event } of buffer) { |
| 820 | const subscription = this.subscriptions.get(subId); |
| 821 | if (subscription?.mode === "live") { |
| 822 | subscription.onEvent(event); |
| 823 | } |
| 824 | } |
| 825 | } |
| 826 | |
| 827 | private handleEose(subId: string) { |
| 828 | const subscription = this.subscriptions.get(subId); |