I am only able to reproduce this issue in my rancher kubernetes cloud. Locally it runs fine. However, if I spawn a new thread which calls sleep in a loop. Rocket will hang and I don't know why.
tokio::spawn(async move {
loop {
thread::sleep(Duration::from_secs(1));
}
});
This makes it really hard to know run some function every x seconds.
using tokio::time::sleep instead as explained by @aleksander-krauze in the comments fixed the issue.