Skip to content

Requesting data from server too "quickly" results in sqlite3.OperationalErrorΒ #100

@BelKed

Description

@BelKed

Related to ActivityWatch/aw-webui#392.
Seems like the database gets locked when requesting another request before the current one is finished.

2023-01-24 22:28:31 [ERROR]: Exception on /api/0/buckets/aw-watcher-window_BelKeds-MBP/events [GET]  (aw-server:1449)
Traceback (most recent call last):
  File "peewee.py", line 3237, in execute_sql
sqlite3.OperationalError: database is locked

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "flask/app.py", line 1517, in full_dispatch_request
  File "flask/app.py", line 1503, in dispatch_request
  File "aw_server/rest.py", line 46, in decorator
  File "flask_restx/api.py", line 405, in wrapper
  File "flask/views.py", line 84, in view
  File "flask_restx/resource.py", line 46, in dispatch_request
  File "aw_server/rest.py", line 208, in get
  File "aw_server/api.py", line 43, in g
  File "aw_server/api.py", line 191, in get_events
  File "aw_datastore/datastore.py", line 101, in get
  File "aw_datastore/storages/peewee.py", line 304, in get_events
  File "peewee.py", line 1962, in inner
  File "peewee.py", line 2033, in execute
  File "peewee.py", line 2206, in _execute
  File "peewee.py", line 3250, in execute
  File "peewee.py", line 3244, in execute_sql
  File "peewee.py", line 3010, in __exit__
  File "peewee.py", line 192, in reraise
  File "peewee.py", line 3237, in execute_sql
peewee.OperationalError: database is locked

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions