Repos / pytaku / 4a022e39a2
commit 4a022e39a2701833465620f26e81a3ac303d973a
Author: Bùi Thành Nhân <hi@imnhan.com>
Date: Mon Aug 24 00:11:33 2020 +0700
more lax db busy timeout
diff --git a/pyproject.toml b/pyproject.toml
index fbdb802..df8f397 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pytaku"
-version = "0.3.1"
+version = "0.3.2"
description = ""
authors = ["Bùi Thành Nhân <hi@imnhan.com>"]
license = "AGPL-3.0-only"
diff --git a/src/pytaku/database/common.py b/src/pytaku/database/common.py
index 15ffeec..1bc6095 100644
--- a/src/pytaku/database/common.py
+++ b/src/pytaku/database/common.py
@@ -24,6 +24,14 @@ def get_conn():
_conn = apsw.Connection(DBNAME)
# Apparently you need to enable this pragma per connection:
_conn.cursor().execute("PRAGMA foreign_keys = ON;")
+ # No idea what the default db busy timeout is, but apparently it's super strict:
+ # got BusyError almost consistently when clicking "finish" on latest chapter,
+ # making FE send both a "read" and "get title" request at roughly the same time.
+ # It still makes no sense though, since "get title" is supposedly a read-only
+ # operation and only "read" is a write. According to docs, WAL mode allows 1
+ # writer and unlimited readers at the same time. WTF guys?
+ # But anyway, until I can get to the bottom of it, let's slap on a band-aid:
+ _conn.setbusytimeout(1000)
_conn.setrowtrace(_row_trace)
return _conn