Skip to content

Commit

Permalink
Check to see if these are empty before closing them.
Browse files Browse the repository at this point in the history
If there is an error when creating the queue, currently it tries to close the queue but it can't because it doesn't exist. So check to see if it exists before closing it.
  • Loading branch information
plockaby committed Jun 16, 2024
1 parent 1e973d1 commit 5cf4501
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 5cf4501

Please sign in to comment.