mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 08:51:02 -06:00
prevent panic in remote backend retry
Ensure that the *http.Response is not nil before checking the status.
This commit is contained in:
parent
43737f2f4f
commit
35d232481f
@ -495,7 +495,7 @@ func (b *Remote) retryLogHook(attemptNum int, resp *http.Response) {
|
||||
// The retry logic in the TFE client will retry both rate limited
|
||||
// requests and server errors, but in the remote backend we only
|
||||
// care about server errors so we ignore rate limit (429) errors.
|
||||
if attemptNum == 0 || resp.StatusCode == 429 {
|
||||
if attemptNum == 0 || (resp != nil && resp.StatusCode == 429) {
|
||||
// Reset the last retry time.
|
||||
b.lastRetry = time.Now()
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user