Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

[1.4.X] Set the post process cache when finished instead of one by one.

This should prevent a race condition if running collectstatic is
canceled or its cache is accessed from other processes, leaving the
cache in a corrupt state.
  • Loading branch information...
1 parent ffe620f commit 35423f6fb1bf6f8dcde657debbe981943474985b @jezdez jezdez committed
Showing with 6 additions and 3 deletions.
  1. +6 −3 django/contrib/staticfiles/
9 django/contrib/staticfiles/
@@ -190,8 +190,8 @@ def post_process(self, paths, dry_run=False, **options):
if dry_run:
- # delete cache of all handled paths
- self.cache.delete_many([self.cache_key(path) for path in paths])
+ # where to store the new paths
+ hashed_paths = {}
# build a list of adjustable files
matches = lambda path: matches_patterns(path, self._patterns.keys())
@@ -240,9 +240,12 @@ def post_process(self, paths, dry_run=False, **options):
hashed_name = force_unicode(saved_name.replace('\\', '/'))
# and then set the cache accordingly
- self.cache.set(self.cache_key(name), hashed_name)
+ hashed_paths[self.cache_key(name)] = hashed_name
yield name, hashed_name, processed
+ # Finally set the cache
+ self.cache.set_many(hashed_paths)
class CachedStaticFilesStorage(CachedFilesMixin, StaticFilesStorage):

0 comments on commit 35423f6

Please sign in to comment.
Something went wrong with that request. Please try again.