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

Error logging can be improved when the DB write is not possible #140

Open
raokrutarth opened this issue Nov 10, 2020 · 0 comments
Open

Error logging can be improved when the DB write is not possible #140

raokrutarth opened this issue Nov 10, 2020 · 0 comments

Comments

@raokrutarth
Copy link

The code block below creates a new dict but fails when the file system does not allow file locks (or something else related to permissions).

def _get_queue_mapper_db_sesh() -> persistqueue.PDict:
    db_path = environ.get("GENERIC_EVENT_DB_PATH")
    assert db_path is not None, f"Invalid queue mapping db path: {db_path}"
    return persistqueue.PDict(
        path=db_path,
        name="generic_proxy_queues_mapppings",
        multithreading=True,
    )

But, the error points to a missing attribute at first instead of terminating the app at the DB lock error:

# Traceback (most recent call last):
#   File "<string>", line 17, in <module>
#   File "<string>", line 10, in _get_queue_mapper_db_sesh
#   File "/opt/python/3.8.5/lib/python3.8/site-packages/persistqueue/pdict.py", line 22, in __init__
#     super(PDict, self).__init__(path, name=name,
#   File "/opt/python/3.8.5/lib/python3.8/site-packages/persistqueue/sqlbase.py", line 89, in __init__
#     self._init()
#   File "/opt/python/3.8.5/lib/python3.8/site-packages/persistqueue/sqlbase.py", line 101, in _init
#     self._conn = self._new_db_connection(
#   File "/opt/python/3.8.5/lib/python3.8/site-packages/persistqueue/sqlbase.py", line 129, in _new_db_connection
#     conn.execute('PRAGMA journal_mode=WAL;')
# sqlite3.OperationalError: database is locked
# Exception ignored in: <function SQLiteBase.__del__ at 0x7fb9913efaf0>
# Traceback (most recent call last):
#   File "/opt/python/3.8.5/lib/python3.8/site-packages/persistqueue/sqlbase.py", line 202, in __del__
#     self._getter.close()
# AttributeError: 'PDict' object has no attribute '_getter'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant