v1.4.1
@harperfast/prerender-browser v1.4.1
Two worker-resilience fixes surfaced while load-testing the multi-process render-service
supervisor in Docker. No API changes for existing callers.
Fixes
-
Survive render failures (the blocker).
RenderWorker.run()logged render rejections with
this.render(job).catch(logger.error)— a pino method passed unbound, so on any render
failure the catch itself threw (Cannot read properties of undefined (reading 'Symbol(pino.msgPrefix)')), turning a logged failure into an unhandledRejection that killed
the worker (a crash loop under the supervisor). Now wrapped:
.catch((err) => logger.error({ err }, 'failed to render job')). Verified live in Docker — a
browser-launch failure is now logged and the worker stays up. -
Graceful SIGTERM drain. Previously SIGTERM/SIGINT just
setTimeout(exit, 1000), dropping
every in-flight render (a job leaves Harper's queue at claim time and is only posted back at the
end ofrender(), so each rolling deploy lost claimed-but-unfinished jobs until their TTL
re-queued them). NowRenderWorker.shutdown()stops the queue consumer (abortable, so it doesn't
wait out the idle poll), drains in-flight renders (Promise.allSettled, bounded by a deadline),
then tears down.ErrorHandlerdrains via an optionalonTerminatehook wired from
startWorker, with a hard backstop before the supervisor's SIGKILL grace.
Notes
- No breaking changes;
ErrorHandleroptions are optional. 20/20 tests pass. dist/is built at release time (gitignored); the tarball workflow runsnpm run build.