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

update to tokio 1.0 #1246

Merged
merged 5 commits into from
Jan 5, 2021
Merged

update to tokio 1.0 #1246

merged 5 commits into from
Jan 5, 2021

Conversation

ibraheemdev
Copy link
Contributor

@ibraheemdev ibraheemdev commented Nov 27, 2020

I updated the tokio version to 0.3.4 and updated to the new runtime::Builder api. The updated runtime is equivalent to the current single-threaded runtime.

Resolves #1240

@ibraheemdev
Copy link
Contributor Author

Unrelated question: Is there any reason that you do not use tokio's multi-threaded runtime?

@Keats Keats changed the base branch from master to next November 27, 2020 14:32
@Keats Keats changed the base branch from next to master November 27, 2020 14:33
@Keats
Copy link
Collaborator

Keats commented Nov 27, 2020

I don't think this works, it's going to miss the reactor. Running it locally I get:

thread '<unnamed>' panicked at 'there is no reactor running, must be called from the context of Tokio runtime', /Users/vincentprouillet/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/io/driver/mod.rs:202:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@ibraheemdev
Copy link
Contributor Author

Tokio 0.2 and 0.3 are not backward compatible. Hyper still depends on tokio 0.2. They completed the 0.3 upgrade on their dev branch but haven't released a new version yet. Because we depend on Hyper, we have to wait till they release a new version, or use the tokio-compat-02 compatibility layer.

@Keats
Copy link
Collaborator

Keats commented Nov 27, 2020

Ah I thought it had been updated. Let's wait until hyper gets released then

@ibraheemdev
Copy link
Contributor Author

ibraheemdev commented Dec 25, 2020

I updated tokio to 1.0.1 and hyper to 0.14.1. The issue now is that hyper-staticfile seems to be unmaintained and is still using hyper 0.13 which is causing compatibility issues.

@Keats I could also write the file server directly with hyper and tokio::fs is you want.

You might also consider using warp instead of hyper directly, which would simplify things a lot

@ibraheemdev ibraheemdev changed the title update to tokio 0.3.4 update to tokio 1.0 Dec 25, 2020
@Keats
Copy link
Collaborator

Keats commented Dec 26, 2020

Which one would be the simplest without adding many new dependencies?

@ibraheemdev
Copy link
Contributor Author

The simplest would probably be to just write the file server manually. It would only require enabling the fs feature of Tokio.

@Keats
Copy link
Collaborator

Keats commented Dec 26, 2020

Let's go with that then if it's not too much work

@ibraheemdev
Copy link
Contributor Author

ibraheemdev commented Dec 26, 2020

I wrote a simple custom file server and successfully tested it locally. This should conclude the Tokio 1.0 migration.

The hyper-staticfile dep has been removed.

@Keats
Copy link
Collaborator

Keats commented Dec 27, 2020

Thanks it works well! I'll merge it when reqwest is updated to avoid having multiple tokio versions

@Keats Keats merged commit 741b6bf into getzola:master Jan 5, 2021
@Keats
Copy link
Collaborator

Keats commented Jan 5, 2021

Thanks!

Keats added a commit that referenced this pull request Jan 5, 2021
@Keats
Copy link
Collaborator

Keats commented Jan 5, 2021

(I messed up an didn't notice the PR was on master instead of next so I've reverted it while I push the commit on the right branch)

Keats added a commit that referenced this pull request Jan 5, 2021
Not by me: #1246
Can't be arsed to figure out the issue I had with cherry-picking
the commit and submodules.
Originally merged on master by mistake
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.

Update zola serve to use latest tokio on next branch
2 participants