7. JavaScript delay and timeout handling #9

Closed
opened 2026-05-20 15:31:09 -06:00 by ppreeper · 0 comments
Owner

Description

Implement --javascript-delay and --timeout for controlling render timing.

Tasks

  • --javascript-delay <ms> → use Chrome --virtual-time-budget=<ms> or wait strategy
  • --timeout <seconds> → set max wait time for Chrome process
  • WKHTMLTOPDF_TIMEOUT env var as default timeout
  • Default timeout: 60 seconds
  • Kill Chrome process on timeout, exit code 3
  • Use subprocess with timeout parameter

Acceptance Criteria

  • --javascript-delay 5000 waits 5 seconds before printing PDF
  • --timeout 30 kills Chrome after 30 seconds, exits with code 3
  • Env var WKHTMLTOPDF_TIMEOUT=120 sets default to 120 seconds
  • CLI --timeout overrides env var
  • Timeout produces clear error message on stderr

Notes

  • Chrome --virtual-time-budget pauses execution for specified milliseconds
  • Use subprocess.run(timeout=...) or process.wait(timeout=...)
  • Relates to PRD #2
## Description Implement `--javascript-delay` and `--timeout` for controlling render timing. ## Tasks - [ ] `--javascript-delay <ms>` → use Chrome `--virtual-time-budget=<ms>` or wait strategy - [ ] `--timeout <seconds>` → set max wait time for Chrome process - [ ] `WKHTMLTOPDF_TIMEOUT` env var as default timeout - [ ] Default timeout: 60 seconds - [ ] Kill Chrome process on timeout, exit code 3 - [ ] Use `subprocess` with timeout parameter ## Acceptance Criteria - `--javascript-delay 5000` waits 5 seconds before printing PDF - `--timeout 30` kills Chrome after 30 seconds, exits with code 3 - Env var `WKHTMLTOPDF_TIMEOUT=120` sets default to 120 seconds - CLI `--timeout` overrides env var - Timeout produces clear error message on stderr ## Notes - Chrome `--virtual-time-budget` pauses execution for specified milliseconds - Use `subprocess.run(timeout=...)` or `process.wait(timeout=...)` - Relates to PRD #2
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ppreeper/wkhtmltopdf#9
No description provided.