Fix SQLite 'database is locked' under concurrent fetches #99
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/issue-97-sqlite-locking"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the
sqlite3.OperationalError: database is lockedseen when a manual "Fetch All" overlaps the scheduler's fetch job.Two changes:
database.py: a SQLiteconnecthook runsPRAGMA busy_timeout = 30000on every connection, so a writer waits up to 30s instead of erroring immediately.scheduler._fetch_stream_job,fetch_hashtag_stream, liveview_fetch_all_active_streams) nowdb.commit()the saved posts + deterministic auto-reject before the slow AI classification, releasing the write lock during the network-bound image download + vision calls, then a second commit for the classification + AI auto-reject.Test:
test_database.pyasserts the busy-timeout hook runs the PRAGMA.Refs #97