(app: App)
| 130 | } |
| 131 | |
| 132 | async fn auto_restart_task(app: App) { |
| 133 | if !app.config.cvm.auto_restart.enabled { |
| 134 | info!("Auto restart CVMs is disabled"); |
| 135 | return; |
| 136 | } |
| 137 | let mut interval = |
| 138 | tokio::time::interval(Duration::from_secs(app.config.cvm.auto_restart.interval)); |
| 139 | loop { |
| 140 | info!("Checking for exited VMs"); |
| 141 | if let Err(err) = app.try_restart_exited_vms().await { |
| 142 | error!("Failed to restart exited VMs: {err:?}"); |
| 143 | } |
| 144 | interval.tick().await; |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | #[rocket::main] |
| 149 | async fn main() -> Result<()> { |
no test coverage detected