-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Question: safety of multiple HTTPProviders #2814
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
Comments
I'm not sure if this relates to the session caching that was recently changed here: #1847 (comment) |
Currently it is, but only if you're using the same URL. The PR linked is a fix to allow multiple Web3 instances with the same URL too.
Not that I know of, but there might be.
I believe so. The PR mentioned above should fix that though, and again, only if you're using the same provider URL.
Right. You should not use |
After thinking further about allowing multiple web3 instances with the same provider type and URL, we decided to highlight and discourage that use case in the docs. The fix introduces a lot of complexity for what seems like a pretty small edge case. @menaitm - if you (or anyone else following along) have a use case for this feature though that they'd like to advocate for, we'd be happy to reconsider. |
Uh oh!
There was an error while loading. Please reload this page.
Example
A single python process which can connect to multiple RPC endpoints may look like this:
However, the docs state you should not create multiple HTTPProviders:
Questions
endpoint_uri
as the key, so does this comment actually mean that you should only create one HTTPProvider per RPC URI per python process?WebsocketProvider
s instead?AsyncHTTPProvider
too?WebsocketProvider
mean you should not useasyncio.gather()
to fire off multiple requests concurrently (to prevent race conditions when receiving messages in a different order back from the node)?Thanks
The text was updated successfully, but these errors were encountered: