Skip to content

Commit bbd7ab9

Browse files
auvipyCopilot
andauthored
Update djcelery/snapshot.py
Co-authored-by: Copilot <[email protected]>
1 parent 9415676 commit bbd7ab9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

djcelery/snapshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def _handle_tasks():
136136
except InterfaceError as e:
137137
# When connection already closed exception is raised,
138138
# force to close connection and Django will automatically reconnect
139-
if str(e) == 'connection already closed':
139+
if getattr(e, 'args', None) and 'connection already closed' in e.args[0]:
140140
connection.close()
141141
logger.info(
142142
'Django db connection is closed and will reconnect'

0 commit comments

Comments
 (0)