Skip to content

Client won't retry on "429 Too Many Requests" #590

@antoinedeschenes

Description

@antoinedeschenes

Hi, I noticed a lot of 429 errors coming through without any retry attempts in the v2025.8.5 release. Dumping the client attributes showed that all retry options were unset:

    maxRetries:           0,
    retryBaseDelay:       0,
    retryExponentialRate: 0.000000,
    retryHttpStatus:      []int(nil),

I traced it to an issue with the WithRequestModifier function in go-graphql-client that misses setting all retry fields in the returned client: hasura/go-graphql-client#186

I worked around it by adding go-retryablehttp as a custom Transport, but perhaps WithRequestModifier should be replaced with a custom RoundTripper in the mean time?

retryClient := retryablehttp.NewClient()
retryClient.RetryMax = 3
retryClient.RetryWaitMin = time.Second * 1
retryClient.RetryWaitMax = time.Second * 10
retryClient.Logger = nil // Disable retryable http client default logging

opslevelClient := opslevel.NewGQLClient(
	opslevel.SetAPIToken(opsleveAPIToken),
	opslevel.SetTransport(retryClient.StandardClient().Transport),
)
return opslevelClient  

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions