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

feat(transport): support customizing Channel's async executor #935

Merged
merged 3 commits into from
Mar 15, 2022

Conversation

davidpdrsn
Copy link
Member

@davidpdrsn davidpdrsn commented Mar 4, 2022

Motivation

At Embark we've been working on integrating tokio-console into our project and have used hyper::client::Builder::executor to pass our own executor that spawns named tasks. However its not possible to do that tonic, so tasks spawned by tonic are left unnamed.

Solution

  • Add tonic's own Executor trait. Its identical to hyper's but added here not to have a public dependency on hyper.
  • Added Endpoint::executor builder method to support setting another executor.
  • Spawn tower::buffer::Buffer tasks on the given executor.
  • Still uses tokio::spawn by default.

I intentionally didn't touch the server side because we don't need that at Embark but could do that if we think its relevant.

Copy link
Member

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

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

Not opposed to this at all, though I am happy to just use hyper's since there is a plan for 1.0 there.

@davidpdrsn
Copy link
Member Author

I've moved to hyper's Executor trait.

@LucioFranco LucioFranco merged commit 0859d82 into master Mar 15, 2022
@LucioFranco LucioFranco deleted the david/customize-executor branch March 15, 2022 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants