-
Notifications
You must be signed in to change notification settings - Fork 886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Caching of RendererHelper in view_config() #1268
Comments
Specifically the issue in |
I think it's surprising that the invocations of The current behavior of caching the |
Renderers are intentionally agnostic to whether they are serving asset specs, or files or whatever else, so I doubt much can be done by Pyramid to alleviate this other than providing some helpers that renderers could use to handle this logic. |
incomplete: Wanted to get the thoughts and findings that @mmerickel were going through down in the bug tracker.
As of right now
pyramid_mako
has broken thepyramid.reload_templates
setting, digging into it a little deeper the issue can be traced back to the renderer factories return being cached inRendererHelper
: https://github.com/Pylons/pyramid/blob/master/pyramid/renderers.py#L400When used with
render()
, this isn't really an issue since a newRenderHelper
is created for each call to it.However using
view_config()
theRendererHelper
gets cached, so after the first request the return from the renderer factory is reified and the factory is never called again, and theRendererHelper
persists.To support
reload_templates
the returned function that deals with rendering is actually doing all of the work of verifying the template on disk has changed or not, this basically moves any logic for asset resolving out of a one time thing in the factory back into something that has to be done every time the renderer is called and there is no good way to cache the information so that asset resolving doesn't have to be done each and every call to render.Is there a better way to solve this, to support
reload_templates
without having to go through the trouble the renderers currently go through? Is there a way to save the result of an asset lookup, or an effective way to cache it?The text was updated successfully, but these errors were encountered: