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: Add TokioTimer to rt::tokio module #73

Merged
merged 2 commits into from
Dec 9, 2023

Conversation

daxhuiberts
Copy link
Contributor

In the latest master branch of hyper the hello server example has been changed to include a TokioTimer.

This exists in hyper's support module, but does not yet exist in hyper-util.

This PR adds that functionality by copying over the implementation from hyper.

Similar to TokioExecutor in this repo. It can only be created through the new constructor. This differs from hyper's support module, where both TokioExecutor and TokioTimer are directly creatable as an empty struct.

src/rt/tokio.rs Outdated Show resolved Hide resolved
@seanmonstar
Copy link
Member

Thanks for noticing and submitting this, I appreciate it a ton! ❤️

@seanmonstar seanmonstar merged commit 7af1744 into hyperium:master Dec 9, 2023
15 checks passed
@loyd
Copy link

loyd commented Dec 17, 2023

Hi, when will it be published?

yukiiiteru added a commit to yukiiiteru/volo that referenced this pull request Dec 19, 2023
The `TokioTimer` and `TokioSleep` from `timer.rs` are copied from
`hyper-util`.

Since these are very important, but the new version of `hyper-util`
containing these has not been released yet, I copied it temporarily.

`timer.rs` will be removed once the `hyper-util` 0.1.2 released, and
`hyper_util::rt::TokioTimer` will be used directly.

Refer: hyperium/hyper-util#73

Signed-off-by: Yu Li <wfly1998@sina.com>
yukiiiteru added a commit to yukiiiteru/volo that referenced this pull request Dec 19, 2023
Both server and client of `hyper` need to set a timer, otherwise they
will **panic** when timeout occurs.

But `hyper` does not provide an implementation of the trait `Timer`,
and even if `hyper-util` does provide one, updates are not released in
new versions.

To solve this problem, I copied `TokioTimer` and `TokioSleep` from the
latest repository of `hyper-util` and put them into `time.rs`.

`timer.rs` will be removed once the `hyper-util` 0.1.2 released, and
`hyper_util::rt::TokioTimer` will be used directly.

Refer: hyperium/hyper-util#73

Signed-off-by: Yu Li <wfly1998@sina.com>
yukiiiteru added a commit to cloudwego/volo that referenced this pull request Dec 20, 2023
* chore(volo-http): bump volo-http

* fix(volo-grpc): add `timer` for hyper client and server

Both server and client of `hyper` need to set a timer, otherwise they
will **panic** when timeout occurs.

But `hyper` does not provide an implementation of the trait `Timer`,
and even if `hyper-util` does provide one, updates are not released in
new versions.

To solve this problem, I copied `TokioTimer` and `TokioSleep` from the
latest repository of `hyper-util` and put them into `time.rs`.

`timer.rs` will be removed once the `hyper-util` 0.1.2 released, and
`hyper_util::rt::TokioTimer` will be used directly.

Refer: hyperium/hyper-util#73

---------

Signed-off-by: Yu Li <wfly1998@sina.com>
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