Skip to content

Commit

Permalink
stop converting timeouts to/from minutes (#3421) (#426)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Apr 27, 2020
1 parent fa19c3c commit a5493db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions google/common_operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func CommonRefreshFunc(w Waiter) resource.StateRefreshFunc {
}
}

func OperationWait(w Waiter, activity string, timeoutMinutes int, pollInterval time.Duration) error {
func OperationWait(w Waiter, activity string, timeout time.Duration, pollInterval time.Duration) error {
if OperationDone(w) {
if w.Error() != nil {
return w.Error()
Expand All @@ -138,7 +138,7 @@ func OperationWait(w Waiter, activity string, timeoutMinutes int, pollInterval t
Pending: w.PendingStates(),
Target: w.TargetStates(),
Refresh: CommonRefreshFunc(w),
Timeout: time.Duration(timeoutMinutes) * time.Minute,
Timeout: timeout,
MinTimeout: 2 * time.Second,
PollInterval: pollInterval,
}
Expand Down
7 changes: 4 additions & 3 deletions google/compute_operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package google
import (
"bytes"
"fmt"
"time"

"google.golang.org/api/compute/v1"
)
Expand Down Expand Up @@ -79,10 +80,10 @@ func (w *ComputeOperationWaiter) TargetStates() []string {
}

func computeOperationWait(config *Config, res interface{}, project, activity string) error {
return computeOperationWaitTime(config, res, project, activity, 4)
return computeOperationWaitTime(config, res, project, activity, 4*time.Minute)
}

func computeOperationWaitTime(config *Config, res interface{}, project, activity string, timeoutMinutes int) error {
func computeOperationWaitTime(config *Config, res interface{}, project, activity string, timeout time.Duration) error {
op := &compute.Operation{}
err := Convert(res, op)
if err != nil {
Expand All @@ -98,7 +99,7 @@ func computeOperationWaitTime(config *Config, res interface{}, project, activity
if err := w.SetOp(op); err != nil {
return err
}
return OperationWait(w, activity, timeoutMinutes, config.PollInterval)
return OperationWait(w, activity, timeout, config.PollInterval)
}

// ComputeOperationError wraps compute.OperationError and implements the
Expand Down

0 comments on commit a5493db

Please sign in to comment.