Skip to content

Commit

Permalink
fix sleep to be between all iterations (instead of not having one bef…
Browse files Browse the repository at this point in the history
…ore first iteration and an extra after last
  • Loading branch information
tvdfly committed May 30, 2023
1 parent 21b73d4 commit a9d4bd8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flaps/flaps.go
Expand Up @@ -386,12 +386,12 @@ func (f *Client) ListFlyAppsMachines(ctx context.Context) ([]*api.Machine, *api.
}
if errors.Is(err, FlapsErrorNotFound) {
for {
if (err != nil && !errors.Is(err, FlapsErrorNotFound)) || tries > 3 {
if tries > 3 || (err != nil && !errors.Is(err, FlapsErrorNotFound)) {
break
}
time.Sleep(b.Duration())
err = f.sendRequest(ctx, http.MethodGet, "", nil, &allMachines, nil)
tries += 1
time.Sleep(b.Duration())
}
}
if err != nil {
Expand Down

0 comments on commit a9d4bd8

Please sign in to comment.