Add Retry-After header when recovering the connection

This commit is contained in:
Laurence Isla
2021-10-21 21:08:29 -05:00
committed by GitHub
parent 8e11b6f5df
commit b15dd8783e
3 changed files with 16 additions and 0 deletions
+11
View File
@@ -188,6 +188,17 @@ A great way to inspect incoming HTTP requests including headers and query parame
The options to ngrep vary depending on the address and host on which you've bound the server. The binding is described in the :ref:`configuration` section. The ngrep output isn't particularly pretty, but it's legible.
.. _automatic_recovery:
Automatic Connection Recovery
-----------------------------
When PostgREST loses the connection to the database, it retries the connection using capped exponential backoff, with 32 seconds being the maximum backoff time.
This retry behavior is triggered immediately after the connection is lost if :ref:`db-channel-enabled` is set to true (this is the default behavior), otherwise it will be activated once a request is made.
To notify the client when the next reconnection attempt will be, PostgREST responds with ``503 Service Unavailable`` and the ``Retry-After: x`` header, where ``x`` is the number of seconds programmed for the next retry.
Database Logs
-------------
+2
View File
@@ -8,6 +8,7 @@ aud
Auth
auth
authenticator
backoff
balancer
Beles
Bouscal
@@ -123,6 +124,7 @@ Rafaj
RDS
reallyreallyreallyreallyverysafe
Rechkemmer
reconnection
Redux
refactor
Remo
+3
View File
@@ -32,6 +32,9 @@ Added
* Allow escaping inside double quotes with a backslash, e.g. ``?col=in.("Double\"Quote")``, ``?col=in.("Back\\slash")``. See :ref:`reserved-chars`.
|br| -- `@steve-chavez <https://github.com/steve-chavez>`_
* Add ``Retry-After`` header when recovering the connection. See :ref:`automatic_recovery`.
|br| -- `@gautam1168 <https://github.com/gautam1168>`_
* Documentation improvements
+ Added :ref:`nested_embedding` to the :ref:`resource_embedding` section.