-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Batched async http provider #2323
Conversation
Oh, and I didn't test this well. Could you guys help me do that? |
9e7c6cf
to
3f72c71
Compare
I see now that there is some coordination being done in issue #1413. I'll see where this feature can fit in there and change what I need to. |
3f72c71
to
7b38e0a
Compare
For the purposes of the event, assume a response was received even when no request was made.
The async_make_post_request was causing quite a lot of problems when I tried to use this for my project. I regularly need to make many thousands of requests and aiohttp kept throwing a timeout error. This /may/ be slightly more stable - it is better for my project for sure. The caller is async anyway, so in theory we should not be giving up much performance.
c708d04
to
32ca1f4
Compare
I hate you with great vehemence web3py maintainers...
I hate you even more vehemently web3py maintainers
9b300c4
to
5a6a097
Compare
Will catch more problems.
I'm going to close this PR as stale for now. If it ends up being refactored at some point we can open it up. Now that the middlewares are able to be separated into request processing and response processing, batched requests are on the roadmap and support should be coming soon. Keep an eye out for that in |
Thanks for the hard work here by the way :) |
What was wrong?
I couldn't make batch requests seamlessly.
Related to Issue #832
How was it fixed?
The implementation in #832 seemed promising, but I need the batching for http requests. I think the best way to do this is at the provider level. I thought I could come up with a simple method by using asyncio (along with the inheriting from AsyncHTTPProvider). I went ahead and wrote a simple implementation. This required some hacks in
web3.web3.contract.py
to include anasync_call_contract_function
. In the end I have a lot of repeated code and I'm not entirely sure how to integrate it best into web3.py. The batching of contract functions works, but it is not very well integrated into web3py.Todo:
web3.web3.contract.py
(need help from you guys :D)Cute Animal Picture
You can test the batching with this code: