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

Make TaskExecutor a wrapper around TokioExecutor #1159

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

aaronmondal
Copy link
Member

@aaronmondal aaronmondal commented Jul 15, 2024

Instead of custom-managing a pool of futures we now spawn tasks directly. This simplifies task handling significantly and enables migration to hyper 1.x which wasn't compatible with the old TaskExecutor.


This change is Reviewable

Instead of custom-managing a pool of futures we now spawn tasks
directly. This simplifies task handling significantly and enables
migration to hyper 1.x which wasn't compatible with the old TaskExecutor.
@aaronmondal aaronmondal marked this pull request as ready for review July 15, 2024 05:06
Copy link
Member Author

@aaronmondal aaronmondal left a comment

Choose a reason for hiding this comment

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

+@allada +@adam-singer +@caass +@jhpratt

Reviewable status: 0 of 4 LGTMs obtained, and pending CI: Analyze (javascript-typescript), Analyze (python), Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, Installation / macos-13, Installation / macos-14, Installation / ubuntu-22.04, Local / ubuntu-22.04, Publish image, Publish nativelink-worker-init, Publish nativelink-worker-lre-cc, Remote / large-ubuntu-22.04, asan / ubuntu-22.04, docker-compose-compiles-nativelink (20.04), docker-compose-compiles-nativelink (22.04), integration-tests (20.04), integration-tests (22.04), macos-13, pre-commit-checks, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, vale, windows-2022 / stable (waiting on @adam-singer, @allada, @caass, and @jhpratt)

Copy link
Member

@adam-singer adam-singer left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: 1 of 4 LGTMs obtained, and pending CI: Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, Installation / macos-13, Installation / macos-14, Installation / ubuntu-22.04, Publish image, Publish nativelink-worker-init, Publish nativelink-worker-lre-cc, Remote / large-ubuntu-22.04, asan / ubuntu-22.04, docker-compose-compiles-nativelink (20.04), docker-compose-compiles-nativelink (22.04), integration-tests (20.04), integration-tests (22.04), macos-13, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, windows-2022 / stable (waiting on @allada, @caass, and @jhpratt)

Copy link
Member

@allada allada left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed all commit messages.
Reviewable status: 2 of 4 LGTMs obtained (waiting on @caass and @jhpratt)


src/bin/nativelink.rs line 733 at r1 (raw file):

                        let serve_connection = if let Some(tls_acceptor) = maybe_tls_acceptor {
                            match tls_acceptor.accept(tcp_stream).await {
                                Ok(tls_stream) => Either::Left(http.serve_connection(

fyi, you can use .left_future() and .right_future() in FuturesExt.

Copy link
Member Author

@aaronmondal aaronmondal left a comment

Choose a reason for hiding this comment

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

-@caass -@jhpratt

Reviewable status: :shipit: complete! 2 of 2 LGTMs obtained

@aaronmondal aaronmondal merged commit b7ef3b6 into TraceMachina:main Jul 16, 2024
29 checks passed
@aaronmondal
Copy link
Member Author

fyi, you can use .left_future() and .right_future() in FuturesExt.

@allada I wasn't sure whether the method chaining could lead to reduced performance compared to directly using the enum. But it turns out that this is not the case and performance-wise this seems to be purely a matter of style preference: https://docs.rs/futures-util/0.3.30/src/futures_util/future/future/mod.rs.html#222-225

In terms of error messages I found it easier to debug with Either as it provides more "direct" error messages with concrete types (similar to e.g. Some) rather than raising "unsatisfied trait bound" messages.

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.

5 participants