Skip to content

Commit

Permalink
Tune polling intervals for an overall faster ValidateEgress() (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
abyrne55 authored Aug 1, 2024
1 parent 8024971 commit 87b6710
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions pkg/clients/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,13 @@ func (c *Client) TerminateEC2Instance(ctx context.Context, instanceID string) er
return handledErrors.NewGenericError(err)
}

// Wait up to 5 minutes for the instance to be terminated
// Wait up to 5 minutes for the instance to be terminated, using a lower
// MinDelay than the default 15s so that we don't wait unnecessarily
reduceMinDelay := func(i *ec2.InstanceTerminatedWaiterOptions) {
i.MinDelay = 3 * time.Second
}
waiter := ec2.NewInstanceTerminatedWaiter(c)
if err := waiter.Wait(ctx, &ec2.DescribeInstancesInput{InstanceIds: []string{instanceID}}, 5*time.Minute); err != nil {
if err := waiter.Wait(ctx, &ec2.DescribeInstancesInput{InstanceIds: []string{instanceID}}, 5*time.Minute, reduceMinDelay); err != nil {
return handledErrors.NewGenericError(err)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/verifier/aws/aws_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func (a *AwsVerifier) findUnreachableEndpoints(ctx context.Context, instanceID s
a.writeDebugLogs(ctx, "Scraping console output and waiting for user data script to complete...")

// Periodically scrape console output and analyze the logs for any errors or a successful completion
err := helpers.PollImmediate(30*time.Second, 4*time.Minute, func() (bool, error) {
err := helpers.PollImmediate(10*time.Second, 270*time.Second, func() (bool, error) {
b64EncodedConsoleOutput, err := a.AwsClient.GetConsoleOutput(ctx, &ec2.GetConsoleOutputInput{
InstanceId: awsTools.String(instanceID),
Latest: awsTools.Bool(true),
Expand Down

0 comments on commit 87b6710

Please sign in to comment.