scripts: Fix incorrect garbage-collection of emoji/node caches.

Apparently, we were incorrectly expressing the paths in the
caches_in_use data structures for these two cache-cleaning algorithms,
resulting in the default threshhold_days algorithm controlling which
caches could be garbage-collected.  While the emoji one was just a
performance optimization for upgrade-zulip-from-git, it was possible
for the main `node_modules` cache in use in production to be GCed,
resulting in LaTeX rendering being broken.
This commit is contained in:
Tim Abbott
2018-12-03 11:59:08 -08:00
parent 74007e7f00
commit e13de3e629
2 changed files with 4 additions and 2 deletions

View File

@@ -35,7 +35,8 @@ def get_caches_in_use(threshold_days):
# This happens for a deployment directory extracted from a
# tarball, which just has a copy of the emoji data, not a symlink.
continue
caches_in_use.add(os.readlink(emoji_link_path))
# The actual cache path doesn't include the /emoji
caches_in_use.add(os.path.dirname(os.readlink(emoji_link_path)))
return caches_in_use
def main(args: argparse.Namespace) -> None:

View File

@@ -45,7 +45,8 @@ def get_caches_in_use(threshold_days):
# If 'package.json' file doesn't exist then no node_modules
# cache is associated with this setup.
continue
caches_in_use.add(os.readlink(node_modules_link_path))
# The actual cache path doesn't include the /node_modules
caches_in_use.add(os.path.dirname(os.readlink(node_modules_link_path)))
return caches_in_use