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

Fix helloworld tutorial. #546

Merged
merged 1 commit into from
Feb 2, 2021

Conversation

16yuki0702
Copy link
Contributor

Motivation

I got a error when trying to run helloworld tutorial

thread 'main' panicked at 'there is no reactor running, must be called from the context of a Tokio 1.x runtime'

because tonic 0.4 currently depends on Tokio 1.x.

Solution

updated example to use Tokio 1.x.

@@ -179,7 +179,7 @@ impl Greeter for MyGreeter {
Finally, let's define the Tokio runtime that our server will actually run on. This requires Tokio to be added as a dependency, so make sure you included that!

```rust
#[tokio::main]
#[tokio::main(flavor = "current_thread")]
Copy link
Contributor

@olix0r olix0r Jan 27, 2021

Choose a reason for hiding this comment

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

It would probably better to use the multithreaded runtime by adding the feature and removing these flavor changes.

@@ -115,7 +115,7 @@ path = "src/client.rs"
[dependencies]
tonic = "0.4"
prost = "0.7"
tokio = { version = "0.2", features = ["macros"] }
tokio = { version = "1.0", features = ["macros"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
tokio = { version = "1.0", features = ["macros"] }
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }

updated tutorial to use tokio 1.x.
@16yuki0702
Copy link
Contributor Author

@olix0r Thank for review!
I fixed to use rt-multi-thread.

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.

3 participants