How can we run async jobs in the background? I have tried
System::new("scheduler")
.system()
.arbiter()
.spawn(Box::pin(async move {
loop {
scheduler.tick().await;
// Cannot use `std::thread::sleep` because it blocks the Tokio runtime.
time::sleep(scheduler.time_till_next_job()).await;
}
}));
How can we run async jobs in the background? I have tried
But it does not work as expected.
Also see https://github.com/ntex-rs/ntex/issues/335#issuecomment-2071434629