wrolpi/modules/videos
Roland f61cbb6e81
videos: channel POST begins as a writer
POST /api/videos/channels failed with "database is locked" on
`INSERT INTO collection` on the docker WROLPi while background workers
(config saves, refreshes) were writing.  The handler wrote through the
deferred request session: `create_channel` reads (the URL/name/directory
conflict check) and then INSERTs, and SQLite refuses that mid-transaction
lock upgrade instantly when another connection wrote in between --
busy_timeout is skipped for upgrades.

Same shape and same fix as POST /api/download (daf2ba39): the handler
now uses `get_db_session(commit=True)`, which begins IMMEDIATE so the
concurrent writer waits its turn, and which commits before the refresh
is fired so the refresh does not wait on a lock the request still holds.

The regression test commits a write from a second connection between
the handler's conflict check and its INSERT.  The existing
`write_lock_held_briefly` helper cannot reproduce this: the Sanic test
client takes over a second to start the app, so its lock is released
before the handler runs.  Before the fix the test fails with the
production error verbatim.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 14:03:27 -06:00
..
channel videos: channel POST begins as a writer 2026-09-15 14:03:27 -06:00
test search: don't COUNT(*) OVER() the page query (#702) 2026-09-12 14:44:30 -06:00
video search: don't COUNT(*) OVER() the page query (#702) 2026-09-12 14:44:30 -06:00
__init__.py videos: an uploaded audio file never appeared in its Channel (#675) 2026-08-23 15:18:15 -06:00
api.py Unifying video download settings so that global/channel/rss/video 2026-03-05 17:40:17 -07:00
common.py review: ffprobe out of the write transaction, and three tests that were watching nothing 2026-08-07 20:15:50 -06:00
conftest.py Search: fast ABC mode by default, opt-in deep search 2026-07-03 10:32:16 -06:00
cookies.py Using shared context to sync cookies between processes. 2026-02-22 14:32:27 -07:00
downloader.py videos: codec download preferences with transcode and strict-fail options (#701) 2026-09-07 09:12:00 -06:00
errors.py Adding toggle to Channel page to stop downloading comments for certain channels. 2025-03-01 18:23:29 -07:00
lib.py videos: codec download preferences with transcode and strict-fail options (#701) 2026-09-07 09:12:00 -06:00
models.py Fix API stalls: non-blocking switch worker, threaded searches, indexed Videos page (#678) 2026-08-29 16:17:53 -06:00
normalize_video_url.py A video that is uploaded is attached to its Channel. Saving Channels config with both download url and frequency in case downloads config is corrupted. 2024-10-16 18:56:11 -06:00
schema.py Fix API stalls: non-blocking switch worker, threaded searches, indexed Videos page (#678) 2026-08-29 16:17:53 -06:00
transcode.py videos: codec download preferences with transcode and strict-fail options (#701) 2026-09-07 09:12:00 -06:00