diff options
| -rw-r--r-- | src/main.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index cba59b8..4fd002a 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -544,7 +544,23 @@ async fn machine_containers_wait( | |||
| 544 | ) -> Result<()> { | 544 | ) -> Result<()> { |
| 545 | tracing::info!("waiting for {} containers to exit", containers.len()); | 545 | tracing::info!("waiting for {} containers to exit", containers.len()); |
| 546 | let script = machine_containers_wait_script(containers); | 546 | let script = machine_containers_wait_script(containers); |
| 547 | machine_run_script(ctx, machine, &script).await?; | 547 | let retry_seconds = 5; |
| 548 | let mut retries = 10; | ||
| 549 | loop { | ||
| 550 | match machine_run_script(ctx, machine, &script).await { | ||
| 551 | Ok(_) => break, | ||
| 552 | Err(err) => { | ||
| 553 | tracing::debug!("failed to run script: {err}, {retries} left"); | ||
| 554 | if retries == 0 { | ||
| 555 | return Err(err); | ||
| 556 | } | ||
| 557 | retries -= 1; | ||
| 558 | tracing::debug!("waiting {retry_seconds} before retrying..."); | ||
| 559 | tokio::time::sleep(Duration::from_secs(retry_seconds)).await; | ||
| 560 | tracing::debug!("retrying"); | ||
| 561 | } | ||
| 562 | } | ||
| 563 | } | ||
| 548 | tracing::info!("all containers exited"); | 564 | tracing::info!("all containers exited"); |
| 549 | Ok(()) | 565 | Ok(()) |
| 550 | } | 566 | } |
