mirror of
https://github.com/ollama/ollama-js.git
synced 2026-07-01 11:16:25 -04:00
fix: release ReadableStream reader after iteration completes (#277)
The parseJSON function obtained a ReadableStreamDefaultReader but never called releaseLock() when iteration finished. This caused Deno's test runner to detect a memory leak with streaming responses.
This commit is contained in:
@@ -308,6 +308,7 @@ export const parseJSON = async function* <T = unknown>(
|
||||
const { done, value: chunk } = await reader.read()
|
||||
|
||||
if (done) {
|
||||
reader.releaseLock()
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user