Skip to content

Commit

Permalink
Fix aborting
Browse files Browse the repository at this point in the history
  • Loading branch information
jdesboeufs committed Sep 12, 2024
1 parent e9323fc commit 04d5ea5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/batch.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import createError from 'http-errors'
import onFinished from 'on-finished'

export function batch({cluster}) {
return async (req, res) => {
const ac = new AbortController()
req.on('close', () => ac.abort())
onFinished(res, () => ac.abort()) // Abort the batch request if the client disconnects

const {requests} = req.body

Expand Down

0 comments on commit 04d5ea5

Please sign in to comment.