Skip to content

Commit

Permalink
Properly dispose of unused undici HTTP responses (#3344)
Browse files Browse the repository at this point in the history
Properly dispose of unused http responses
  • Loading branch information
matthieusieben authored Jan 9, 2025
1 parent 9dc7251 commit 48a0e9d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changeset/afraid-peas-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@atproto/dev-env": patch
"@atproto/ozone": patch
---

Properly dispose of unused http responses
2 changes: 1 addition & 1 deletion packages/dev-env/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions packages/ozone/src/daemon/blob-diverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class BlobDiverter {
})

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

if (result.statusCode !== 200) {
result.body.destroy()
await result.body.dump()
throw new XRPCError(
result.statusCode,
undefined,
Expand Down

0 comments on commit 48a0e9d

Please sign in to comment.