wrolpi/modules
lrnselfreliance 9797af157a
Removing a duplicate video keeps the Download that is finishing (#942)
* A refresh that finishes before tags.yaml is imported no longer reports a failed save (#941)

Every refresh fires save_tags_config at its cleanup.  In the first seconds
after a start, a refresh can finish before the startup import of tags.yaml,
which on a rebuilt database happens while the first refresh runs.  The dump
then asked ConfigFile.save to write a database that held no tags over the
file; the save guard refused, as it must, but it did so with an ERROR traceback
and a "Failed to save config: config/tags.yaml" event for the user, although
nothing was lost: the import that followed read the file and recreated the tags.

save_tags_config now skips the dump while the config has not been imported and
says so at WARNING.  The file stays the source of truth until the import.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

* Removing a duplicate video keeps the Download that is finishing

After a video download, Video.delete_duplicate_videos removes the other copies
of the same video, which happens when the file name changed (a renamed file, a
new title).  Each copy was deleted through FileGroup.delete, which also deletes
the Download of the copy's URL and, without one, adds the URL to the skip list.
The duplicates share that URL with the video just downloaded, so the Download
still running was deleted from under its worker: the worker read its row again
to record the result and failed with NoResultFound ("Unexpected error"), and the
download's record was gone.

FileGroup.delete and Video.delete take keep_download; the duplicate cleanup
passes it, so the URL's Download and the skip list are left alone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Only a duplicate at the downloaded URL keeps its Download

delete_duplicate_videos also finds copies by source_id, and those can sit under
another URL.  Such a copy is deleted as any video is, with that URL's Download
or a skip-list entry; only a copy that shares the URL being downloaded leaves
the finishing Download alone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-02 19:18:46 -07:00
..
archive A download records the sha256 of its files in the wrolpi section (#904) 2026-10-30 19:34:49 -06:00
docs Hiding a Calibre book's cover and metadata uses the modeler's session (#936) 2026-11-02 11:04:28 -07:00
flasher Configs without database rows read and validate only; imports run off the event loop (#874) 2026-10-25 15:17:31 -06:00
inventory The inventory legacy-date repair no longer takes the save lock during import (#915) 2026-11-02 11:58:42 -07:00
map Map downloads are checked against the hash in the signed manifest (#934) 2026-11-01 20:38:57 -07:00
repos A malformed entry stops a backup preview or merge with an error naming it (#896) 2026-10-27 20:59:49 -06:00
videos Removing a duplicate video keeps the Download that is finishing (#942) 2026-11-02 19:18:46 -07:00
zim The Zim list reads each Zim's metadata in the libzim worker instead of opening it in the API (#939) 2026-11-02 18:19:29 -07:00
__init__.py Add a Repos module that mirrors git repositories (#783) 2026-10-07 15:16:58 -06:00