Skip to content

Commit

Permalink
Delay longer
Browse files Browse the repository at this point in the history
  • Loading branch information
alexparlett committed Jul 6, 2021
1 parent 0d670c8 commit 024d786
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/provider/resource_kafkaconnect_connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,21 +198,23 @@ func checkIfConnectorExists(
meta interface{}) (bool, error) {
client := meta.(*connect.Client)

var attempts = 60
var delay = 5 * time.Second
var exists bool
retryError := try.Do(func(attempt int) (bool, error) {
_, _, err := client.GetConnectorStatus(data.Id())
if err != nil {
if apiError, ok := err.(connect.APIError); ok {
if apiError.Code == 404 {
if attempt < 30 {
time.Sleep(1 * time.Second)
if attempt < attempts {
time.Sleep(delay)
return true, nil
}
return false, nil
}
}
if attempt < 30 {
time.Sleep(1 * time.Second)
if attempt < attempts {
time.Sleep(delay)
return true, err
}
return false, err
Expand Down

0 comments on commit 024d786

Please sign in to comment.