feat: add PDF render timing to convert and demo routes
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Failing after 1m42s
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Failing after 1m42s
- renderPdf() and renderUrlPdf() now return { pdf, durationMs }
- Timing wraps the actual render with Date.now()
- Log render duration via logger.info
- Add X-Render-Time response header in convert and demo routes
- Update all callers in convert, demo, templates routes
- Add TDD tests in render-timing.test.ts
- Update existing test mocks for new return shape
This commit is contained in:
parent
0283e9dae8
commit
f9caef82e6
13 changed files with 165 additions and 23 deletions
|
|
@ -166,7 +166,7 @@ templatesRouter.post("/:id/render", async (req: Request, res: Response) => {
|
|||
const sanitizedPdf = { format: "A4" as string, ...validation.sanitized };
|
||||
|
||||
const html = renderTemplate(id, data);
|
||||
const pdf = await renderPdf(html, sanitizedPdf);
|
||||
const { pdf, durationMs } = await renderPdf(html, sanitizedPdf);
|
||||
|
||||
const filename = sanitizeFilename(data._filename || `${id}.pdf`);
|
||||
res.setHeader("Content-Type", "application/pdf");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue