Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid stacktrace on process exit in Client.__del__() #3397

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,10 @@ def __exit__(self, exc_type, exc_value, traceback):
self.close()

def __del__(self):
self.close()
try:
self.close()
except Exception:
pass

def close(self) -> None:
# In case a connection property does not yet exist
Expand Down
5 changes: 4 additions & 1 deletion redis/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,10 @@ def __exit__(self, exc_type, exc_value, traceback):
self.close()

def __del__(self):
self.close()
try:
self.close()
except Exception:
pass

def disconnect_connection_pools(self):
for node in self.get_nodes():
Expand Down
Loading