MCPcopy Index your code
hub / github.com/codeaashu/claude-code / cleanupStream

Function cleanupStream

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

Source from the content-addressed store, hash-verified

2896 * @internal Exported for testing
2897 */
2898export 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.

Callers 1

releaseStreamResourcesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected