Skip to content

Commit

Permalink
Catch MariaDB connection errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Hopper262 committed Aug 15, 2021
1 parent 774c917 commit c387c91
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ReconnectingConnectionPool.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ def _runInteraction(self, interaction, *args, **kw):
try:
return adbapi.ConnectionPool._runInteraction(self, interaction, *args, **kw)
except pymysql.OperationalError as e:
if e[0] not in (2006, 2013):
# 1927: MariaDB: connection killed
# 2006: MySQL: server has gone away
# 2013: MySQL: lost connection during query
if e.args[0] not in (1927, 2006, 2013):
raise
log.msg("RCP: got error %s, retrying operation" %(e))
conn = self.connections.get(self.threadID())
Expand Down

0 comments on commit c387c91

Please sign in to comment.