actix / actix-net

A collection of lower-level libraries for composable network services.
https://actix.rs
Apache License 2.0
704 stars 345 forks source link

Use the new tokio `LocalRuntime` in `actix_rt` #597

Open Sytten opened 1 week ago

Sytten commented 1 week ago

This is a tracking issue

Tokio is deprecating the LocalSet (https://github.com/tokio-rs/tokio/issues/6741) in favour of a new LocalRuntime (https://github.com/tokio-rs/tokio/issues/6739) which will avoid panics if a user mixes tokio::spawn with tokio::spawn_local/actix_rt::spawn. It should also improve performances.

Once this is released we should migrate to the new runtime.

Noah-Kennedy commented 1 week ago

This is also likely to improve your performance a bit.

robjtede commented 1 week ago

It's also possible that LocalRuntime will be easy enough to use that we can just make actix-rt optional altogether. In particular, if there's a #[tokio::main(flavor = "local")] or similar.

Noah-Kennedy commented 1 week ago

It's also possible that LocalRuntime will be easy enough to use that we can just make actix-rt optional altogether. In particular, if there's a #[tokio::main(flavor = "local")] or similar.

You should leave this in the LocalSet issue thread as well so folks know that the macros are something you care about.

Sytten commented 1 week ago

We will still need the system and arbiter concepts so pretty sure we will keep the crate around for some time.

robjtede commented 1 week ago

We'd only need them for actors. The crate can stay around but it would be removed from the dependency tree of actix-web in a major release.