MCPcopy Create free account
hub / github.com/Noumena-Network/code / cleanupStream

Function cleanupStream

src/services/api/claude.ts:2925–2939  ·  view source on GitHub ↗
(
  stream: Stream<BetaRawMessageStreamEvent> | undefined,
)

Source from the content-addressed store, hash-verified

2923 * @internal Exported for testing
2924 */
2925export function cleanupStream(
2926 stream: Stream<BetaRawMessageStreamEvent> | undefined,
2927): void {
2928 if (!stream) {
2929 return
2930 }
2931 try {
2932 // Abort the stream via its controller if not already aborted
2933 if (!stream.controller.signal.aborted) {
2934 stream.controller.abort()
2935 }
2936 } catch {
2937 // Ignore - stream may already be closed
2938 }
2939}
2940
2941/**
2942 * Updates usage statistics with new values from streaming API events.

Callers 1

releaseStreamResourcesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected