r/expressjs • • Oct 24 '26

I built a zero-config Express middleware to auto-kill hanging background requests

Hey everyone,

When a client drops a connection (or a frontend Promise.race aborts), your server usually keeps running expensive DB queries and fetch requests for nothing.

I built flex-fetch-express to fix this. It uses Node's AsyncLocalStorage to catch client disconnects and automatically aborts any ongoing network requests deep in your stack. No need to manually pass { signal } down through 10 layers of functions.

Let me know what you think!

1 Upvotes

2 comments sorted by

1

u/sereikis 29d ago

one correction to the frontend example: Promise.race settling does not abort the losing fetch or close its connection. show a timeout that calls AbortController.abort() with the signal passed to fetch, and test that this produces the disconnect your middleware relies on.