-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
web3.js Connection http agent hanging tests and cli utilities #25069
Comments
Love it. Thanks for pointing this out. |
Is there any update about this issue? |
Hey! No update, no. Still worth doing though! We just have to do it thoughtfully. I haven't sat down to really think about whether making the Agent an explicit input is the right thing to do (breaking change) or whether to add a destructor (not effective unless people use it). |
Thanks for working on this. Looking forward to this being resolved. 👍 |
K, I wasn't comfortable creating a whole bunch of new API surface area, so what I ended up doing was to:
|
Problem
In the Connection class the AgentManager is used in order to pool http connections to the rpc server. Since the keepAlive option is used, the agent will hang until destroy() is called. To go around this there is a timeout which will destroy the agent 5 seconds after the last request.
But this still hangs the node process for 5 seconds which is an issue for CLI utilities and tests which use Connection. For example, it causes the following message when running jest tests (which I'm sure many have encoutered due to this):
Proposed Solution
Either / or:
connection.close()
method which will callagent.destroy()
to clean up the connection gracefullycc @steveluscher @jstarry
The text was updated successfully, but these errors were encountered: