mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-26 09:56:17 -05:00
* A move neither scans every FileGroup nor stalls the downloader's writes
Two stalls made a 109 file move take three minutes on a large library:
- Planning joined the move_sources temp table to file_group. The temp
table has no statistics, so with a real library's statistics SQLite
scanned all of file_group (233k rows, 2.4 GB) instead of looking up 109
paths in the primary_path index. CROSS JOIN fixes the join order.
- The move's write transaction yielded to the event loop between chunks.
The process that moves files also downloads; a download's write then
waited on the move's lock synchronously, so the event loop could not
resume the move: each write waited out the 30 s busy_timeout and failed
("Unable to renew downloads!"). The transaction now runs in a thread
(inline in tests, which share one connection), so another writer waits
only until the move commits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A cancelled move waits for its thread however often it is cancelled
Review fix: the move waited for its thread on the first cancellation by
awaiting the thread's future again, unshielded. Shutdown cancels twice
(run_loops cancels the file worker loop and stops waiting after 15 s, then
asyncio.run cancels every pending task, including the thread's future), so
the second cancellation raised while the thread was still in its
transaction, and handle_move reverted the files the thread then committed.
The move now waits on a threading.Event the thread sets when it leaves its
transaction, absorbing every cancellation meanwhile. A cancelled future
reads "done" while its thread still runs, so it cannot be that signal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| blobs | ||
| collections | ||
| files | ||
| scripts | ||
| static/extensions | ||
| test | ||
| vendor | ||
| __init__.py | ||
| api_utils.py | ||
| bookmarks.py | ||
| bookmarks_api.py | ||
| captions.py | ||
| cmd.py | ||
| common.py | ||
| config_api.py | ||
| config_import.py | ||
| config_schema.py | ||
| config_version.py | ||
| conftest.py | ||
| contexts.py | ||
| dates.py | ||
| db.py | ||
| db_bootstrap.py | ||
| db_query.py | ||
| downloader.py | ||
| errors.py | ||
| events.py | ||
| flags.py | ||
| fts.py | ||
| jobs.py | ||
| lang.py | ||
| log_levels.py | ||
| logging_extra.py | ||
| media_path.py | ||
| perpetual.py | ||
| roland@learningselfreliance.com.gpg | ||
| root_api.py | ||
| schema.py | ||
| schema_ddl.py | ||
| scrape_downloader.py | ||
| speedtest.py | ||
| switches.py | ||
| tags.py | ||
| test_media_path.py | ||
| upgrade.py | ||
| vars.py | ||
| version.py | ||
| version.txt | ||