Skip to content

Commit

Permalink
dont wait forever revlink warmup, wait 15 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
tphoney committed Dec 16, 2024
1 parent 9bd7af4 commit 33f6f06
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/e2eplan.tape
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ Type@1ms "overmind terraform plan -- -out tfplan"
Enter
Sleep 2
Enter
Sleep 60
Sleep 80
Screenshot e2e/plan.png
4 changes: 4 additions & 0 deletions cmd/pterm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 13 additions & 4 deletions cmd/terraform_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

///////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 33f6f06

Please sign in to comment.