fix: stop retrying ebooks that can't be parsed #55
No reviewers
Labels
No labels
bug
critical
ebook-branch
high
low
main
medium
release-blocker
security
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jfro/fuzzy_catalog!55
Loading…
Reference in a new issue
No description provided.
Delete branch "jtk/ebook-cancel-unprocessable"
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?
ProcessWorkerreturned{:error, reason}for corrupt or unsupported files, so Oban retried each one 3 times and re-hashed the whole file every time, for an error that can't change.Change
extract_metadata/1now tags parse and unsupported-format errors as{:unprocessable, reason}. On that,do_perform/2marks the ebook failed (same message as before), updates library progress, logs a warning with the ebook id and file name, and returns{:cancel, reason}.file not found(from the stat, or from the extractor if the file vanished in between; a remounted share can bring it back), DB errors (Postgrex raises are re-raised as before), and anything else that comes back as a plain{:error, _}.inspected now. Before, interpolating it would have crashed.JobFailureHandleralready handles:cancelledProcessWorker jobs. It skips ebooks that are already failed, so the error message isn't overwritten.Tests
{:cancel, reason}, ebook failed with that reason, cancel logged..txt) →{:cancel, _}with "Unsupported file format".{:error, _}(existing test).mix precommitpasses.Fixes #22
ProcessWorker returned {:error, reason} for corrupt and unsupported files, so Oban retried each one 3 times and re-hashed the file every time. Metadata extraction errors now mark the ebook failed and return {:cancel, reason}. A missing file and database errors still return or raise so Oban retries them. Fixes #22Review from Nye (approved)
Checked: "file not found: " prefix matches MetadataExtractor exactly (ZipReader's "File not found in EPUB: " is a missing entry, correctly unprocessable); JobFailureHandler skips already-failed ebooks on :cancelled; failed ebooks are re-queued by ScanWorker on the next scan (scan_worker.ex:282), so a wrong cancel recovers on rescan.
Low (non-blocking, your call):