CartoDB / CartoDB-SQL-API

CartoDB SQL API
BSD 3-Clause "New" or "Revised" License
63 stars 65 forks source link

Return 'Retry-after' header when 'Carto-Rate-Limit-Remaining' is 0 #628

Closed rjimenezda closed 4 years ago

rjimenezda commented 5 years ago

The header Retry-After is extremely useful, since it lets users take advantage of the 'Leaky-bucket' type of limits we have. However, in order to get this header, you must trigger a 429 error.

In practice, a client of the SQL API is going to look at two headers:

As the API stands right now, when you get Carto-Rate-Limit-Remaining: 0, you have to make another request (which you know is going to fail), to trigger the error, get the Retry-After and know exactly how much you have to wait.

What would be ideal is to return the Retry-After header when Carto-Rate-Limit-Remaining is 0, as well as on 429 errors.

rafatower commented 4 years ago

Closing in favor of https://app.clubhouse.io/cartoteam/story/84293/return-retry-after-header-when-carto-rate-limit-remaining-is-0