File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -53,9 +53,14 @@ impl TemplateData {
5353 self . rendering_threadpool . spawn ( {
5454 let templates = self . clone ( ) ;
5555 move || {
56- // `.send` only fails when the receiver is dropped,
57- // at which point we don't need the result any more.
58- let _ = send. send ( render_fn ( & templates) ) ;
56+ // the job may have been queued on the thread-pool for a while,
57+ // if the request was closed in the meantime the receiver should have
58+ // dropped and we don't need to bother rendering the template
59+ if !send. is_closed ( ) {
60+ // `.send` only fails when the receiver is dropped while we were rendering,
61+ // at which point we don't need the result any more.
62+ let _ = send. send ( render_fn ( & templates) ) ;
63+ }
5964 }
6065 } ) ;
6166
You can’t perform that action at this time.
0 commit comments