Skip to content

Commit

Permalink
Add AdminShutdown to errors that can be retried
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Dick authored and viktordick committed Jan 15, 2020
1 parent 486a167 commit aec3f43
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Products/ZPsycopgDA/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,13 @@ def handle_retry(self, error):

# Errors that only affect our connection and where an immediate retry
# should work.
# AdminShutdown sounds bad, but it might only be our connection that is
# affected. When reconnecting after a regular Retry we see if it
# acutually something serious, in which case we will get something like
# 'the database is shutting down'. If it is only our connection, a
# simple reconnect will work.
connection_error = (
name == 'OperationalError' and (
name in ('AdminShutdown', 'OperationalError') and (
'server closed the connection' in value or
'terminating connection due to administrator command' in value
)
Expand Down

0 comments on commit aec3f43

Please sign in to comment.