Skip to content

Commit

Permalink
Merge pull request #216 from plockaby/catch-exceptions
Browse files Browse the repository at this point in the history
Check to see if these are empty before closing them.
  • Loading branch information
peter-wangxu authored Jun 16, 2024
2 parents 1e973d1 + 5cf4501 commit 51684f2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions persistqueue/sqlbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,10 @@ def _new_db_connection(self, path, multithreading, timeout

def close(self) -> None:
"""Closes sqlite connections"""
self._getter.close()
self._putter.close()
if self._getter is not None:
self._getter.close()
if self._putter is not None:
self._putter.close()

def __del__(self) -> None:
"""Handles sqlite connection when queue was deleted"""
Expand Down

0 comments on commit 51684f2

Please sign in to comment.