Skip to content

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 requested review from Sixtysixter and lupin012 April 1, 2024 22:52
@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
@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.

4 participants