cognitect-labs / aws-api

AWS, data driven
Apache License 2.0
724 stars 100 forks source link

ThrottlingException should be retried by default? #233

Closed xiongtx closed 1 year ago

xiongtx commented 1 year ago

aws-api has automatic retries, but doesn't treat ThrottlingException as a retriable error by default.

clojure.lang.ExceptionInfo: SSM receive account credentials error
                          __type: "ThrottlingException"
    cognitect.anomalies/category: :cognitect.anomalies/incorrect
                       commandId: "ce0bf8a7-896e-4f9d-a8ba-1af13b0134d6"
                         message: "Rate exceeded"

The default retriable anomalies are busy, interrupted, and unavailable, but ThrottlingException results in an incorrect. Would it make sense for it to be busy instead?

dchelimsky commented 1 year ago

Do you know what the http status code was?

Edit: https://docs.aws.amazon.com/awssupport/latest/APIReference/CommonErrors.html says it would have been a 400.

dchelimsky commented 1 year ago

Looking at AWS docs

If you're not using an AWS SDK, you should retry original requests that receive server (5xx) or throttling errors. However, client errors (4xx) indicate that you need to revise the request to correct the problem before trying again.

This is a bit contradictory in this case since they send us a 400 with an indication embedded in a JSON response that it's a ThrottlingError. That said, based on "or throttling errors," I'm inclined to agree that their advice is to retry this.

Fixed in 05117f035b507a0438145107853130f38b1d0464

Leaving this open until it's released.

dchelimsky commented 1 year ago

Released in version 0.8.656