ActivityWatch / ActivityWatch/aw-server

Requesting data from server too "quickly" results in `sqlite3.OperationalError`

未关闭
#100 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
128
派生
94
平均合并
4 天 18 小时
30 天内合并 PR
3

描述

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

```py
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
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。