penpot/media-processor
Andrey Antukh f53668da28 🐛 Harden the SVG worker pool and lazy-load the logger
Follow up on the review of the SVG sanitization commit.

The logger is now lazy: createLogger only builds its child on the first
log call, so importing a module inside an SVG worker no longer spawns
the main logger's transport threads (which the previous comment
wrongly claimed).

The pool stops respawning a slot after five consecutive spawn failures
and degrades to 503 when no worker is left, instead of spinning in a
spawn->fail->respawn loop. A malformed worker message is validated and
treated as a worker failure, and runInSvgPool rejects when the pool is
disabled.

Tests: the real worker entry point is exercised end to end (via tsx),
and the pool covers the spawn cap, malformed messages and the disabled
pool. The remote root check is case-insensitive, and the SVG size hint
uses the project's str/ffmt.

AI-assisted-by: deepseek-v4.1-flash
2026-10-07 19:02:09 +00:00
..