mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-24 18:17:44 -06:00
The canvas rebuilds its render queue from every page, tile and text layer it is still missing, and calls `set_queue` whenever that list changes, which is whenever any answer arrives. Requests a worker had already popped were still missing, so they went back into the queue and an idle worker rendered them a second time. With one worker every other page was rendered twice; with seven workers about half of all renders were duplicates. A slow page could also take every idle worker in turn until the watchdog fired. The pool now remembers the requests its workers have taken until `try_recv` hands out their answer. A queued request equal to one of them is skipped, and an answer removes queued copies of its request. Equal requests to one pool always produce the same answer (its bytes and settings never change), so nothing the caller sees changes except that answers arrive sooner. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>