握り潰したエラー表示
このコミットが含まれているのは:
@@ -295,10 +295,10 @@ async def reconnect_db (
|
||||
try:
|
||||
ensure_mysql_alive ()
|
||||
except Exception as ex:
|
||||
if getattr (ex, 'args', [None])[0] in (2006, 2013):
|
||||
safe_reconnect ()
|
||||
else:
|
||||
if getattr (ex, 'args', [None])[0] not in (2006, 2013):
|
||||
raise
|
||||
print (f"[reconnect_db] { type (ex).__name__ }: { ex }")
|
||||
safe_reconnect ()
|
||||
|
||||
|
||||
def ensure_mysql_alive (
|
||||
@@ -314,6 +314,7 @@ def safe_reconnect (
|
||||
except Exception as ex:
|
||||
if getattr (ex, 'args', [None])[0] not in (2006, 2013):
|
||||
raise
|
||||
print (f"[safe_reconnect] { type (ex).__name__ }: { ex }")
|
||||
|
||||
|
||||
def run_with_mysql_retry (
|
||||
@@ -327,11 +328,11 @@ def run_with_mysql_retry (
|
||||
ensure_mysql_alive ()
|
||||
return fn (*args, **kwargs)
|
||||
except Exception as ex:
|
||||
if getattr (ex, 'args', [None])[0] not in (2006, 2013):
|
||||
raise
|
||||
last = ex
|
||||
if getattr (ex, 'args', [None])[0] in (2006, 2013):
|
||||
safe_reconnect ()
|
||||
continue
|
||||
raise
|
||||
print (f"[run_with_mysql_retry] { type (ex).__name__ }: { ex }")
|
||||
safe_reconnect ()
|
||||
if last:
|
||||
raise last
|
||||
|
||||
|
||||
新しい課題から参照
ユーザをブロックする