From 33f6f06c389e4b2fb81e57ea4853ea00745d0e71 Mon Sep 17 00:00:00 2001 From: TP Honey Date: Mon, 16 Dec 2024 15:28:37 +0000 Subject: [PATCH] dont wait forever revlink warmup, wait 15 seconds --- .github/e2eplan.tape | 2 +- cmd/pterm.go | 4 ++++ cmd/terraform_plan.go | 17 +++++++++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/e2eplan.tape b/.github/e2eplan.tape index fe7f1f67..76f6c01a 100644 --- a/.github/e2eplan.tape +++ b/.github/e2eplan.tape @@ -16,5 +16,5 @@ Type@1ms "overmind terraform plan -- -out tfplan" Enter Sleep 2 Enter -Sleep 60 +Sleep 80 Screenshot e2e/plan.png diff --git a/cmd/pterm.go b/cmd/pterm.go index e04867c3..38e78dbe 100644 --- a/cmd/pterm.go +++ b/cmd/pterm.go @@ -137,6 +137,10 @@ func RunRevlinkWarmup(ctx context.Context, oi sdp.OvermindInstance, postPlanPrin if spinner != nil { spinner.Success("Discovered and linked all resources") + } else { + // if we didn't have a spinner, print a success message + // this can happen if the terminal is not available, or if the revlink warmup is very fast + pterm.Success.Println("Discovered and linked all resources") } return nil diff --git a/cmd/terraform_plan.go b/cmd/terraform_plan.go index ff72bf02..7db3c8a2 100644 --- a/cmd/terraform_plan.go +++ b/cmd/terraform_plan.go @@ -177,10 +177,19 @@ func TerraformPlanImpl(ctx context.Context, cmd *cobra.Command, oi sdp.OvermindI resourceExtractionSpinner.Success() - // wait for the revlink warmup to finish before we update the planned changes - err = revlinkPool.Wait() - if err != nil { - return fmt.Errorf("error waiting for revlink warmup: %w", err) + // wait for the revlink warmup for 15 seconds. if it takes longer, we'll just continue + waitCh := make(chan error, 1) + go func() { + waitCh <- revlinkPool.Wait() + }() + + select { + case err = <-waitCh: + if err != nil { + return fmt.Errorf("error waiting for revlink warmup: %w", err) + } + case <-time.After(15 * time.Second): + pterm.Info.Print("Done waiting for revlink warmup") } ///////////////////////////////////////////////////////////////////