Migrated from: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/536
Narrative
As an image scaler, I want to avoid retrying thumnailing jobs that I know will fail, so that I can save resources
Acceptance Criteria
- Create a "fails" table that will help us track files that permanently fail to be converted to thumbnails
- Store a hash of files that fail chronically due to their nature. The key of the "fails" dabatase shouldn't just contain the file contents hash, it should also be based on page number for multipage documents, etc. because for a PDF it might be that only page X fails, not the entire document. However it's safe to assume that if the thumbnail fails to generate at a given target size, it will fail for all sizes, so target size shouldn't be part of the key.
- Make sure that we detect permanent failures and not failures due to high server load. In order to achieve this we might have to create time-based rules for timeouts, so that we only blacklist a file that times out if it has done so at very different times
- The record in the table needs a timestamp for later invalidation. For example an ImageMagick upgrade might solve a bug that was preventing some thumbnails from being generated and after the upgrade we'll want to invalidate the "fails" database
Follow-up tasks (will need to be separate cards, created if the above is possible):
- Create a special page or similar to access the list of files that have been blacklisted due to their inability to be converted
- Inform the user who has uploaded the file that it can't be thumbnailed
Related Bugs
https://bugzilla.wikimedia.org/show_bug.cgi?id=49118 suggests using img_metadata (presumably a table that already exists)