-
-
Notifications
You must be signed in to change notification settings - Fork 369
Speedup static collection during development #455
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
Conversation
found_files[prefixed_path] = (storage, path) | ||
self.copy_file(path, prefixed_path, storage) | ||
def collect(self, request=None): | ||
if not self.request or not self.request is request: # Prevent execution multiple times per request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be a guard?
if self.request and self.request is request:
return # Prevent execution multiple times per request
self.request = request
found_files = OrdereDict()
[...]
Looks good, thanks a lot |
I don't get why my change would break this? Do you have any idea? |
@snoepkast My current guess, is that your changes in |
@snoepkast the problem is the init like say @cyberdelia, you can convert init get request_var to something like this @property
def request_var(self):
if not self._request_var:
self._request_var = template.Variable('request')
return self._request_var and remove the init call in these methods class StylesheetNode(PipelineMixin, template.Node):
def __init__(self, name):
super(StylesheetNode, self).__init__(name) # this call is the problem
self.name = name
class JavascriptNode(PipelineMixin, template.Node):
def __init__(self, name):
super(JavascriptNode, self).__init__(name) # this call is the problem
self.name = name |
Locally the tests run now, but apparently not on Travis.. But it fails on a native python 'open file' which has nothing to do with any of this? |
Ahh now I see the PR fixing that problem (#459), so this code should work then. |
Merged in 840bf27 |
Amazing work! Now everything is loading under a second for me. Thank you so much for this PR guys! |
The speedup is achieved by only doing the collection once per request instead of once for every time the template tag is used. For reference see issue #428.