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

refactor(boost): add ServiceHandle future #57

Merged
merged 4 commits into from
Jan 26, 2023

Conversation

mattsse
Copy link
Contributor

@mattsse mattsse commented Sep 18, 2022

  • rename async fn Service::run to fn Service::spawn() -> ServiceHandle

  • add ServiceHandle Future that waits for both task to finish

since this launches the server this could be improved to wait until the server is up, but can tackle that after looking at BlindedBlockProviderServer, so perhaps this PR is premature

@mattsse mattsse marked this pull request as draft September 18, 2022 22:34
@mattsse mattsse marked this pull request as ready for review September 19, 2022 21:53
@mattsse
Copy link
Contributor Author

mattsse commented Sep 19, 2022

split Server::run into two functions

  • serve: constructs the axum server
  • spawn: constructs the axum server and spawns to new task

this has the benefit that after calling serve the server is already bound and listens for incoming connections

the ServiceHandle is currently duplicated. imo this fine

Copy link
Owner

@ralexstokes ralexstokes left a comment

Choose a reason for hiding this comment

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

sorry for the delay on this! I haven't used pin_project before so wanted to be able to give it some attention before merging it in

this is excellent and thanks for the contribution :)

this change is strictly better imo as the API now gives better control over when and how the various tasks are constructed/orchestrated -- we can see this where you drop the arbitrary sleep from the integration test code

mev-rs/src/relay.rs Outdated Show resolved Hide resolved
mev-boost-rs/src/service.rs Outdated Show resolved Hide resolved
mev-relay-rs/src/service.rs Show resolved Hide resolved
@ralexstokes
Copy link
Owner

thanks for this! I like adding the ServiceHandle abstraction to provide better granularity around orchestrating the various tasks as they boot and then run

@ralexstokes ralexstokes merged commit 556b0ae into ralexstokes:main Jan 26, 2023
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.

None yet

2 participants