fix: a request during a database restart answers 503, and the logs stay quiet

Sentry DTF-API-8/9 (stack restart, 16/11 09:15): the startup retry kept
the API up, but a board request in the ~7 s without the database got a
500, and the render thread logged its error every 2 s. A request that
hits psycopg.OperationalError now answers 503 "O servidor está
reiniciando" with Retry-After (the web does not report it); the render
thread warns once per outage and backs off; the worker's first outage
line and the audit's connection outage are warnings.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-16 09:32:50 -03:00
parent 00c7fa3dfa
commit bcba1fbe67
6 changed files with 64 additions and 8 deletions

View File

@@ -116,6 +116,8 @@
function apiError(path, status, message, detail) {
if (!started || status === 401 || typeof Sentry === 'undefined') return;
// A restart's few seconds without the database (app/app.py): not a bug.
if (status === 503 && /reiniciando/.test(String(message))) return;
try {
// One issue per kind of API error: without this Sentry groups them all
// by apiError and DTF-WEB-1 mixes a 422 for 66 files with a 422 for