Repository navigation
Paint the TUI on launch before the PDF engine loads, and boot every PDF worker with SIGINT held - #221
Conversation
Launching with a query looked frozen until results arrived. The search already runs off the loop; what held the first frame was launch work ahead of it. - The PDF-texture key promotion runs after the first frame and checks its sentinel before importing the PDF extractor, so a normal launch no longer loads pymupdf's native libraries before painting. - `warm_pool` spawns the PDF worker without waiting for it to boot: `submit` spawns synchronously, which is all the FD-table constraint needs. SIGINT is held across the spawn and unblocked in the worker's initializer, so a ^C during the boot still ends it silently. Windows, with no signal mask, keeps the wait. On an evicted page cache, on_mount fell from 0.46 to 0.57s to 0.16 to 0.18s, and the first frame from 1.66 to 2.69s to 1.02 to 1.61s.
A worker respawned after a crash, stall or stale-FD recovery was spawned from an extraction thread with SIGINT unblocked, so a ^C during its boot printed a KeyboardInterrupt traceback over the TUI before its initializer could install SIG_DFL. Every submit now goes through `_submit`, which holds SIGINT across the call; holding it costs nothing when no spawn happens. Windows has no signal mask and keeps the gap.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Summary
fnd tui "<query>"now paints its first frame before anything loads pymupdf, so the window appears straight away and the progress bar shows the work.on_mountinto_promote_texture_cache_keys, run after the first refresh. Once its sentinel exists it never imports the PDF engine at all.warm_poolno longer waits for the worker to boot.submitstill spawns the process while the FD table is clean, which is all the macOSfds_to_keepfix needed._sigint_held). The initializer setsSIG_DFLand only then unblocks, so a ^C that lands mid-boot ends the worker quietly instead of printing aKeyboardInterrupttraceback (the Quit cleanly on Ctrl+C: no traceback from the PDF worker or teardown #218 guarantee, previously covered only for the first spawn).Tests
tests/test_launch_paints_before_the_pdf_engine.py: a tripwire module stands in forfnd.extract.pdf; a promoted cache reads nothing from it, an unpromoted one does (control), and the promotion runs only afteron_mountreturns.tests/test_worker_sigint_is_silent.py: a FIFO trace file holds a booting worker before its initializer, the test sends SIGINT, then releases it. Covers the warm spawn and a respawn throughrun_in_pool_sync_with_stall_detection. Both fail without the mask (negative controls run), and neither can hang: the reader is non-blocking and outlives pool shutdown.make batch-closegreen on this tree: 6366 passed, 5 skipped; ruff and pyright clean; 12 tmux scenarios passed (1 skipped).Notes
warm_poolkeeps waiting for the boot there; a respawn on Windows still has the ^C boot gap.run_in_poolandrun_in_pool_synchave no callers; left alone as out of scope.