Skip to content

Commit

Permalink
Changes to main.go:
Browse files Browse the repository at this point in the history
* enlarged default value of ACI_MAX_RETRY to 12 for 60 seconds retry window
* now checking for invalid ipv4 address 0.0.0.0
  • Loading branch information
tmeckel committed Dec 14, 2021
1 parent accba62 commit 95da31f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,17 @@ func main() {
}

var container *containerinstance.ContainerGroup
maxRetry, _ := internal.GetenvIntRange("ACI_MAX_RETRY", 4, 1, math.MaxInt)
maxRetry, _ := internal.GetenvIntRange("ACI_MAX_RETRY", 12, 1, math.MaxInt)
timeout, _ := internal.GetenvIntRange("ACI_TIMEOUT", 5, 1, math.MaxInt)

for i := 0; i < maxRetry; i++ {
_container, err := cic.Get(ctx)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to get to container instance: %+v\n", err)
} else if _container.ContainerGroupProperties != nil && _container.ContainerGroupProperties.IPAddress != nil && _container.ContainerGroupProperties.IPAddress.IP != nil {
} else if _container.ContainerGroupProperties != nil &&
_container.ContainerGroupProperties.IPAddress != nil &&
_container.ContainerGroupProperties.IPAddress.IP != nil &&
*_container.ContainerGroupProperties.IPAddress.IP != "0.0.0.0" {
container = _container

break
Expand Down

0 comments on commit 95da31f

Please sign in to comment.