-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Strap a RequestSessionManager to each instance of http providers
#3412
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
Conversation
05126e5 to
ef07dfd
Compare
RequestSessionManager to each instance of http providers
f94656d to
1f4e756
Compare
kclowes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of strapping this manager to a provider is cracking me up for some reason. I'm imagining ratchet straps 😆 Aaaanyway, this looks good to me! There wasn't really a good place to put this in the PR, but what do you think about moving the name of web3/_utils/request.py to something like web3/_utils/request_session_manager.py since the RequestSessionManager class is basically all the file has now? Otherwise I left some small nits, but nothing big.
😆
I think I'll still put the |
Keeping DEFAULT_REQUEST_TIMEOUT in there sounds good to me, and therefore keeping this as request utils also probably makes the most sense? I wouldn't be opposed to splitting it out either though. Whatever you think! |
Actually, we have a _utils/http.py already... I'm thinking that since this is really only managing HTTP sessions, we rename the class to |
|
Yeah, I like that. More specific! |
f8f00df to
e6ceb81
Compare
Sweet. The changes were significant enough. Can I ask for one last pass starting at this commit before we call it done? I also added passing the edit Just kidding I had to update the commit hash, should be good now. I added the timeout check to the integrations tests as well. |
- ``RequestSessionManager`` -> ``HTTPSessionManager`` - Move default timeout for http from ``_utils/request.py`` -> ``_utils/http.py``. This eliminates the need for a ``request.py`` utils since ``HTTPSessionManager`` lives in its own file at ``_utils/http_session_manager.py```. - Pass the configured timeout to sync and async ``cache_and_return_session`` methods. Previously, we were using the hard-coded default value and if the call is coming from a provider (99% of the time), rather than the request method being invoked directly, we would be using the wrong value when spinning off any session closing tasks.
e6ceb81 to
f9352e0
Compare
6b8486f to
78df3fc
Compare
kclowes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left one comment about a None check, but other than that, looks good!
c5c8043 to
6cf1859
Compare
- Improve the async session closing by utilizing a non-blocking asyncio ``Task``.
6cf1859 to
aade88f
Compare
What was wrong?
Though #3265 is not reproducible, this hopefully closes #3265 as there should be no more conflicts across separate instances due to unique instantiation of session managing per provider.
How was it fixed?
request_retry_configurationalong the way (Optional)Todo:
Cute Animal Picture