Skip to content

Commit d81da3d

Browse files
committed
🧹 chore: setImmediate in dynamic afterResponse
1 parent 0b2b7ed commit d81da3d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/dynamic-handle.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,10 @@ export const createDynamicHandler = (app: AnyElysia) => {
581581
return app.handleError(context, reportedError)
582582
} finally {
583583
if (app.event.afterResponse)
584-
for (const afterResponse of app.event.afterResponse)
585-
await afterResponse.fn(context as any)
584+
setImmediate(async () => {
585+
for (const afterResponse of app.event.afterResponse!)
586+
await afterResponse.fn(context as any)
587+
})
586588
}
587589
}
588590
}

0 commit comments

Comments
 (0)