mirror of
https://github.com/rwf2/Rocket.git
synced 2025-01-07 10:12:36 +00:00
ad36b769bc
...because loading up a Rocket while it's ignited is a bad idea. More seriously, because 'Rocket.ignite()' will become an "execute everything up to here" method.
16 lines
503 B
Rust
16 lines
503 B
Rust
#[rocket::async_test]
|
|
async fn test_await_timer_inside_attach() {
|
|
|
|
async fn do_async_setup() {
|
|
// By using a timer or I/O resource, we ensure that do_async_setup will
|
|
// deadlock if no thread is able to tick the time or I/O drivers.
|
|
rocket::tokio::time::sleep(std::time::Duration::from_millis(100)).await;
|
|
}
|
|
|
|
rocket::build()
|
|
.attach(rocket::fairing::AdHoc::on_launch("1", |rocket| async {
|
|
do_async_setup().await;
|
|
rocket
|
|
}));
|
|
}
|