Skip to content
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

Fixed #34679 - Lazy load staticfiles manifest #17015

Closed
wants to merge 1 commit into from

Conversation

jwygoda
Copy link
Contributor

@jwygoda jwygoda commented Jun 26, 2023

Fixed collectstatic when unsupported manifest file already exists.

Comment on lines 469 to 479
self._hashed_files = self.load_manifest()[0]
return self._hashed_files

@hashed_files.setter
def hashed_files(self, value):
self._hashed_files = value

@property
def manifest_hash(self):
if self._manifest_hash is None:
self._manifest_hash = self.load_manifest()[1]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this going to cause the manifest to be loaded twice if both properties are accessed?

What about

Suggested change
self._hashed_files = self.load_manifest()[0]
return self._hashed_files
@hashed_files.setter
def hashed_files(self, value):
self._hashed_files = value
@property
def manifest_hash(self):
if self._manifest_hash is None:
self._manifest_hash = self.load_manifest()[1]
self._hashed_files, self._manifest_hash = self.load_manifest()
return self._hashed_files
@hashed_files.setter
def hashed_files(self, value):
self._hashed_files = value
@property
def manifest_hash(self):
if self._manifest_hash is None:
self._hashed_files, self._manifest_hash = self.load_manifest()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

Fixed collectstatic when unsupported manifest file already exists.
@jwygoda jwygoda force-pushed the 34679/lazy-staticfiles-manifest branch from 5d2bb8f to fa26109 Compare June 26, 2023 17:24
@felixxm
Copy link
Member

felixxm commented Jun 27, 2023

Closing per ticket.

@felixxm felixxm closed this Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants