Skip to content
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

[WS_V2] Improve upon yielding control to the event loop #3135

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

fselmo
Copy link
Collaborator

@fselmo fselmo commented Oct 25, 2023

What was wrong?

  • In order to guarantee that the event loop can run other tasks more efficiently, asyncio.sleep(0) seems to be the most efficient way to yield control back to the event loop in a way that many tasks can still run concurrently without quickly timing out.
  • Increase the default timeout to look for a response to a request from 20 seconds to 50 seconds.
  • Make the caching methods in the request processor synchronous since they don't need to be async.

Todo:

Cute Animal Picture

1000019835

- In order to guarantee that the event loop can run other tasks more efficiently, asyncio.sleep(0) seems to be the most efficient way to yield control back to the event loop in a way that many tasks can still run concurrently without quickly timing out.
- Increase the default timeout to look for a response to a request from 20 seconds to 50 seconds.
- Make the caching methods in the request processor synchronous since they don't need to be async.
@fselmo fselmo changed the title Improve upon yielding control to the event loop [WS_V2] Improve upon yielding control to the event loop Oct 25, 2023
@fselmo fselmo marked this pull request as ready for review October 26, 2023 17:24
@fselmo fselmo requested review from pacrob, reedsa and wolovim October 26, 2023 17:25
Copy link
Contributor

@reedsa reedsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, lgtm!

@fselmo fselmo merged commit 0315a2d into ethereum:main Oct 26, 2023
1 check passed
@fselmo fselmo deleted the websocket-v2-updates branch October 26, 2023 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants