Skip to content

Render Jinja on a separate green thread #543

Answered by mitsuhiko
liketoeatcheese asked this question in Q&A
Discussion options

You must be logged in to vote
  1. Change AutoReloader::new(...) to Arc::new(AutoReloader::new(...))
  2. Change web::Data<minijinja_autoreload::AutoReloader> to web::Data<Arc<minijinja_autoreload::AutoReloader>>
  3. Ensure that env is not held across await points like so:
let test_html = {
    let env = minijinja_env.acquire_env().unwrap();
    env.get_template("test.html").unwrap().render(ctx).unwrap()
};

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@liketoeatcheese
Comment options

@mitsuhiko
Comment options

Answer selected by liketoeatcheese
@liketoeatcheese
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants