Skip to content

Commit

Permalink
Made AppEngine requests retry if they fail due to a P4SA propagation …
Browse files Browse the repository at this point in the history
…delay. (#4453) (#628)

Fixed hashicorp/terraform-provider-google#8333

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Feb 2, 2021
1 parent 875df67 commit 0fa3a21
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion google/error_retry_predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,15 @@ func isNotFilestoreQuotaError(err error) (bool, string) {
}

// Retry if App Engine operation returns a 409 with a specific message for
// concurrent operations.
// concurrent operations, or a 404 indicating p4sa has not yet propagated.
func isAppEngineRetryableError(err error) (bool, string) {
if gerr, ok := err.(*googleapi.Error); ok {
if gerr.Code == 409 && strings.Contains(strings.ToLower(gerr.Body), "operation is already in progress") {
return true, "Waiting for other concurrent App Engine changes to finish"
}
if gerr.Code == 404 && strings.Contains(strings.ToLower(gerr.Body), "unable to retrieve P4SA") {
return true, "Waiting for P4SA propagation to GAIA"
}
}
return false, ""
}
Expand Down

0 comments on commit 0fa3a21

Please sign in to comment.