mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 01:58:41 +01:00
* Run the chroma-key placeholder check off the event loop _discard_if_chroma_key decoded every stored media image synchronously inside an async method, so each check (about 15 to 35 ms for a 1024px screenshot or box face) stalled the event loop and every other request or scan task running on it. The decode now runs through asyncio.to_thread, like the cover and logo work in the same handler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015vP3HFKWQsJZv9F9SKeAWu * Hold the file lock across the chroma-key check and delete With the check awaited on a worker thread, a concurrent writer could replace the file between the verdict and the delete, and the replacement was then removed on the old file's verdict. The existence check, the decode and the unlink now run under the path's lock, and a test replaces the file mid-check to prove the new artwork survives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015vP3HFKWQsJZv9F9SKeAWu * Make the chroma-key replacement test independent of timing The test slept 0.2s and hoped the writer had run by then; a slow writer would let unlocked code pass. It now asserts the path lock is held during the check before the writer starts, and that the writer cannot finish while the check runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015vP3HFKWQsJZv9F9SKeAWu --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>