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:
@@ -146,7 +146,7 @@ def loop():
|
||||
except psycopg.OperationalError as exc:
|
||||
if db_down_since is None:
|
||||
db_down_since = time.monotonic()
|
||||
logging.error('Database unavailable, retrying: %s', exc)
|
||||
logging.warning('Database unavailable, retrying: %s', exc)
|
||||
else:
|
||||
logging.debug('Database still unavailable, retrying in %s s', delay)
|
||||
time.sleep(delay)
|
||||
|
||||
Reference in New Issue
Block a user