Properly dispose of unused undici HTTP responses ()

Properly dispose of unused http responses
This commit is contained in:
Matthieu Sieben 2025-01-09 14:18:07 +01:00 committed by GitHub
parent 9dc7251fc7
commit 48a0e9d606
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions
.changeset
packages
dev-env/src
ozone/src/daemon

@ -0,0 +1,6 @@
---
"@atproto/dev-env": patch
"@atproto/ozone": patch
---
Properly dispose of unused http responses

@ -45,7 +45,7 @@ export const mockResolvers = (idResolver: IdResolver, pds: TestPds) => {
try {
const res = await request(url, { headers: { host: handle } })
if (res.statusCode !== 200) {
res.body.destroy()
await res.body.dump()
return undefined
}

@ -46,7 +46,7 @@ export class BlobDiverter {
})
if (blobResponse.statusCode !== 200) {
blobResponse.body.destroy()
await blobResponse.body.dump()
throw new XRPCError(
blobResponse.statusCode,
undefined,
@ -72,7 +72,7 @@ export class BlobDiverter {
}
} catch (err) {
// Typically un-supported content encoding
blobResponse.body.destroy()
await blobResponse.body.dump()
throw err
}
}
@ -99,7 +99,7 @@ export class BlobDiverter {
})
if (result.statusCode !== 200) {
result.body.destroy()
await result.body.dump()
throw new XRPCError(
result.statusCode,
undefined,