Mercurial > piecrust2
diff piecrust/cache.py @ 424:5feb71d31a4f
internal: Fix caches being orphaned from their directory.
After clearing caches, the instances in memory don't have a file-system
directory anymore. This means that either caching data would crash the app,
or, in the case of baking a site, would make the workers create the directory
but collide randomly while doing so at the same time.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 25 Jun 2015 14:51:12 -0700 |
parents | ff6cc43fb40c |
children | 61d606fbc313 |
line wrap: on
line diff
--- a/piecrust/cache.py Thu Jun 25 08:31:24 2015 -0700 +++ b/piecrust/cache.py Thu Jun 25 14:51:12 2015 -0700 @@ -47,6 +47,10 @@ logger.debug("Cleaning cache: %s" % cache_dir) shutil.rmtree(cache_dir) + # Re-create the cache-dir because now our Cache instance points + # to a directory that doesn't exist anymore. + os.makedirs(cache_dir, 0o755) + def clearCaches(self, except_names=None): for name in self.getCacheNames(except_names=except_names): self.clearCache(name)