Files
kjvstudy.org/kjvstudy_org/static
kennethreitz 9ec7885dce Make PDF generation async to prevent event loop blocking
Convert all PDF generation endpoints from synchronous to async to
prevent blocking FastAPI's event loop during CPU-intensive operations.

Changes:
- Add render_html_to_pdf_async() using ThreadPoolExecutor (2 workers)
- Convert all PDF endpoints to async def
- Use await render_html_to_pdf_async() instead of blocking calls
- Keep render_html_to_pdf() for backward compatibility

Performance impact:
- Prevents event loop blocking during PDF generation
- Allows other requests to be processed while PDFs are rendering
- Limits concurrent PDF generation to 2 workers to control CPU usage

Files updated:
- kjvstudy_org/utils/pdf.py (new async implementation)
- kjvstudy_org/server.py (5 PDF endpoints)
- kjvstudy_org/routes/api.py (4 PDF endpoints)
- kjvstudy_org/routes/resources.py (7 PDF endpoints)
- kjvstudy_org/routes/stories.py (2 PDF endpoints)
- kjvstudy_org/routes/study_guides.py (1 PDF endpoint)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 11:44:35 -05:00
..
2025-11-11 12:24:34 -05:00
2025-05-30 20:24:06 -04:00
2025-05-30 20:24:06 -04:00
2025-06-01 12:43:37 -04:00