Skip to content

Commit

Permalink
Temporarily enable retryServerErrors before metadata request
Browse files Browse the repository at this point in the history
  • Loading branch information
sebasslash committed Jun 21, 2022
1 parent f759c44 commit dfaa6f1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tfe.go
Expand Up @@ -441,6 +441,9 @@ func (c *Client) getRawAPIMetadata() (rawAPIMetadata, error) {
req.Header.Set("Accept", "application/vnd.api+json")
req.Header.Set("Authorization", "Bearer "+c.token)

// Temporarily enable retryServerErrors in case the metadata request fails
c.RetryServerErrors(true)

// Make a single request to retrieve the rate limit headers.
resp, err := c.http.HTTPClient.Do(req)
if err != nil {
Expand All @@ -451,6 +454,9 @@ func (c *Client) getRawAPIMetadata() (rawAPIMetadata, error) {
meta.APIVersion = resp.Header.Get(_headerAPIVersion)
meta.RateLimit = resp.Header.Get(_headerRateLimit)

// Disable after a successful response
c.RetryServerErrors(false)

return meta, nil
}

Expand Down

0 comments on commit dfaa6f1

Please sign in to comment.