trinodb / trino-python-client

Python client for Trino
Apache License 2.0
327 stars 163 forks source link

Handle HTTP 429 responses #457

Closed aalbu closed 2 weeks ago

aalbu commented 6 months ago

Describe the feature

In production, Trino is almost always deployed behind some sort of proxy. It's not uncommon for these proxies to employ some rate limiting mechanism, which typically responds to requests with HTTP 429 (Too Many Requests) to high load. The response might contain a Retry-After header that indicates either the number of seconds the client should wait before retrying the request or the date when the request can be retried.

The Trino Python Client should handle such responses by retrying the request. Incidentally, HTTP 503 (Service Unavailable), which is currently being retried, can also include a Retry-After header, which is not taken into account currently.

Describe alternatives you've considered

No response

Are you willing to submit PR?

hashhar commented 2 weeks ago

Fixed by https://github.com/trinodb/trino-python-client/pull/455