fetch icon indicating copy to clipboard operation
fetch copied to clipboard

Investigate why `jest` exits immediately, since a socket pool is created

Open rauchg opened this issue 6 years ago • 4 comments

I don't know why jest is so fast at quitting if sockets should be remaining open with the introduction of agentkeepalive

rauchg avatar Nov 04 '17 00:11 rauchg

Just had this problem the other day - it was an async/await issue. May be unrelated, but I remember wondering the same thing.

Let's make sure we're using promises correctly and not missing some async keyword or something

Qix- avatar Nov 04 '17 00:11 Qix-

It's possible to call socket.deref() or something like that as well to have an open socket that doesn't keep the event loop running. Perhaps they're using that feature (I believe that the built-in HTTP agent does this).

TooTallNate avatar Nov 09 '17 00:11 TooTallNate

The solution I've used in the past is a timeout promise that either times out and rejects, or otherwise allows you to mark something as resolved by exposing the resolver function.

I've noticed this be a problem with the async function main(argv) { return 0; } approach, cc @rauchg

Qix- avatar Nov 09 '17 01:11 Qix-

@styfle Looks like a mistake, https://github.com/vercel/fetch/commit/32d78b48401e9729a37f38dfb0af97d3f7384e38 is just a license update entirely unrelated to this issue.

Qix- avatar Feb 11 '22 20:02 Qix-

Thank you for the report. We are archiving this project; you can read more details here: https://github.com/vercel/fetch/issues/83

Ethan-Arrowood avatar Nov 09 '23 22:11 Ethan-Arrowood