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

Function safeCloseController

src/services/api/openAICompatWsV2Native.ts:170–180  ·  view source on GitHub ↗
(
      controller: ReadableStreamDefaultController<Uint8Array>,
    )

Source from the content-addressed store, hash-verified

168 }
169
170 const safeCloseController = (
171 controller: ReadableStreamDefaultController<Uint8Array>,
172 ) => {
173 if (streamClosed) return
174 streamClosed = true
175 try {
176 controller.close()
177 } catch {
178 // The consumer may have cancelled while a native read was pending.
179 }
180 }
181
182 const ensureStarted = () => {
183 if (!startPromise) {

Callers 2

startFunction · 0.85
pullFunction · 0.85

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected