mirror of https://github.com/fafhrd91/actix-net
fix test --all-feature failed
This commit is contained in:
parent
d700dc2bbb
commit
1e82dad4f0
|
@ -11,11 +11,18 @@ async fn handle(_req: Request<Body>) -> Result<Response<Body>, Infallible> {
|
|||
|
||||
fn main() {
|
||||
actix_rt::System::with_tokio_rt(|| {
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap()
|
||||
// for io_uring feature use `tokio_uring::Runtime::new(&tokio_uring::builder()).unwrap()`
|
||||
// this cfg is needed when use it with io-uring, if you don't use io-uring
|
||||
// you can remove this cfg and last line in this closure
|
||||
#[cfg(not(feature = "io-uring"))]
|
||||
{
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap()
|
||||
}
|
||||
// you can remove this two lines if you don't have tokio_uring feature enabled
|
||||
#[cfg(feature = "io-uring")]
|
||||
tokio_uring::Runtime::new(&tokio_uring::builder()).unwrap()
|
||||
})
|
||||
.block_on(async {
|
||||
let make_service =
|
||||
|
|
|
@ -5,12 +5,22 @@ use actix_rt::System;
|
|||
|
||||
fn main() {
|
||||
System::with_tokio_rt(|| {
|
||||
// build system with a multi-thread tokio runtime.
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
.worker_threads(2)
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap()
|
||||
// this cfg is needed when use it with io-uring, if you don't use io-uring
|
||||
// you can remove this cfg and last line in this closure
|
||||
#[cfg(not(feature = "io-uring"))]
|
||||
{
|
||||
// build system with a multi-thread tokio runtime.
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
.worker_threads(2)
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap()
|
||||
}
|
||||
// you can remove this two lines if you don't have tokio_uring feature enabled.
|
||||
// Note: tokio_uring is single thread and can't be multithreaded,
|
||||
// unless you spawn multiple of them
|
||||
#[cfg(feature = "io-uring")]
|
||||
tokio_uring::Runtime::new(&tokio_uring::builder()).unwrap()
|
||||
})
|
||||
.block_on(async_main());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue