( stream: Stream<BetaRawMessageStreamEvent> | undefined, )
| 2896 | * @internal Exported for testing |
| 2897 | */ |
| 2898 | export function cleanupStream( |
| 2899 | stream: Stream<BetaRawMessageStreamEvent> | undefined, |
| 2900 | ): void { |
| 2901 | if (!stream) { |
| 2902 | return |
| 2903 | } |
| 2904 | try { |
| 2905 | // Abort the stream via its controller if not already aborted |
| 2906 | if (!stream.controller.signal.aborted) { |
| 2907 | stream.controller.abort() |
| 2908 | } |
| 2909 | } catch { |
| 2910 | // Ignore - stream may already be closed |
| 2911 | } |
| 2912 | } |
| 2913 | |
| 2914 | /** |
| 2915 | * Updates usage statistics with new values from streaming API events. |
no outgoing calls
no test coverage detected