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

rpcdaemon: extract awaitable async task run by executor #1953

Merged
merged 11 commits into from
Apr 9, 2024

Conversation

canepat
Copy link
Member

@canepat canepat commented Apr 1, 2024

This PR introduces a common async_task primitive that can be used to execute a task on some executor and co-await asynchronously for its completion. Typical usage: any I/O thread delegates long-running tasks to a thread pool by calling a coroutine that starts the work and is suspended until completion.

The key factors for introducing this abstraction are:

  • implementation of asio::async_compose + asio::post pattern in one place
  • complete exception handling (missing in many current usages)
  • avoid code duplication
  • improve readability at the call site

The following modules throughout the RPC daemon has been refactored to benefit from async_task:

  • http::Connection
  • evm_debug
  • emv_trace
  • call_many
  • estimate_gas_oracle
  • evm_executor

@canepat canepat added the maintenance Some maintenance work (fix, refactor, rename, test...) label Apr 1, 2024
@canepat canepat marked this pull request as draft April 2, 2024 08:12
@canepat canepat marked this pull request as ready for review April 7, 2024 01:17
@canepat canepat merged commit 4b14186 into master Apr 9, 2024
4 checks passed
@canepat canepat deleted the rpcdaemon_common_async_task branch April 9, 2024 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Some maintenance work (fix, refactor, rename, test...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants