temporarily_unavailable (500)
The request could not be completed right now. The response carries a Retry-After header
(seconds). For a write, nothing was saved in the first two cases below, and repeating it is safe
in every case (a write here either creates the record or returns the existing one). The causes:
-
The write kept losing a race with another change to the same consumer's data, and was given up after a few attempts.
-
Writes for one consumer are applied one at a time, and this one waited about a second for an earlier write of the same consumer that was still in progress. The wait is capped so that a queue behind one slow write can never hold up other consumers or other accounts.
-
The service was busy: no database connection became free for this request within its wait.
-
The database did not answer a step of this request in time. The connection was given up rather than waited on.
-
The service could not reach its database at all when the request arrived. Nothing was done.
No request is left waiting without an answer: each of these waits has a limit.
Fix: try again after Retry-After. If it keeps happening, report the requestId.
The status is 500, not 503: tell this answer from internal_error by error.code.
Most HTTP client libraries retry a 503 by themselves but not a 500, so write the retry
yourself. The API never answers 502, 503 or 504; an HTML page with one of those comes
from the hosting platform, not from the API (see responses and errors).