Skip to content

Render content off the request handler's thread.#141

Open
mkantor wants to merge 3 commits into
masterfrom
non-blocking-template-rendering
Open

Render content off the request handler's thread.#141
mkantor wants to merge 3 commits into
masterfrom
non-blocking-template-rendering

Conversation

@mkantor

@mkantor mkantor commented May 30, 2026

Copy link
Copy Markdown
Owner

The primary goal of this changeset is to make it so requests can't be blocked on slow template rendering, but rather than being targeted to templates only, it moves rendering for all content kinds to a separate blocking thread pool.

I was originally going to try and defer the first chunk of the body stream in RegisteredTemplate while the template renders, but in practice that means passing an engine/registry around and generally makes things complicated (partly because of the get helper). Effort could be better spent making handlebars rendering inherently be async/streaming, but that's something to explore another day.

Fixes #5.

mkantor added 3 commits May 30, 2026 06:59
I'm working on #5 which will involve moving rendering off of the main
request-handling thread. This means `Media` needs to be `Send` so that
it can cross thread boundaries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Template rendering blocks the request handler thread

1 participant