diff --git a/scripts/lib/clean-emoji-cache b/scripts/lib/clean-emoji-cache index 23b213478b..35f8bff97e 100755 --- a/scripts/lib/clean-emoji-cache +++ b/scripts/lib/clean-emoji-cache @@ -51,7 +51,7 @@ def main(): args = parse_args() caches_in_use = get_caches_in_use(args.threshold_days) purge_unused_caches( - EMOJI_CACHE_PATH, caches_in_use, args.threshold_days, args.dry_run, "emoji cache") + EMOJI_CACHE_PATH, caches_in_use, args, "emoji cache") if __name__ == "__main__": main() diff --git a/scripts/lib/clean-npm-cache b/scripts/lib/clean-npm-cache index d4f830022f..aa7da2c697 100755 --- a/scripts/lib/clean-npm-cache +++ b/scripts/lib/clean-npm-cache @@ -61,8 +61,7 @@ def main(): args = parse_args() caches_in_use = get_caches_in_use(args.threshold_days) purge_unused_caches( - NODE_MODULES_CACHE_PATH, caches_in_use, args.threshold_days, - args.dry_run, "node modules cache") + NODE_MODULES_CACHE_PATH, caches_in_use, args, "node modules cache") if __name__ == "__main__": main() diff --git a/scripts/lib/clean-venv-cache b/scripts/lib/clean-venv-cache index 4d086b2d5e..46ad579040 100755 --- a/scripts/lib/clean-venv-cache +++ b/scripts/lib/clean-venv-cache @@ -51,7 +51,7 @@ def main(): args = parse_args() caches_in_use = get_caches_in_use(args.threshold_days) purge_unused_caches( - VENV_CACHE_DIR, caches_in_use, args.threshold_days, args.dry_run, "venv cache") + VENV_CACHE_DIR, caches_in_use, args, "venv cache") if __name__ == "__main__": main() diff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.py index 5942ad4816..4ab3cdb86d 100755 --- a/scripts/lib/zulip_tools.py +++ b/scripts/lib/zulip_tools.py @@ -221,13 +221,13 @@ def get_caches_to_be_purged(caches_dir, caches_in_use, threshold_days): caches_to_purge.add(cache_dir) return caches_to_purge -def purge_unused_caches(caches_dir, caches_in_use, threshold_days, dry_run, cache_type): - # type: (Text, Set[Text], int, bool, Text) -> None +def purge_unused_caches(caches_dir, caches_in_use, args, cache_type): + # type: (Text, Set[Text], argparse.Namespace, Text) -> None all_caches = set([os.path.join(caches_dir, cache) for cache in os.listdir(caches_dir)]) - caches_to_purge = get_caches_to_be_purged(caches_dir, caches_in_use, threshold_days) + caches_to_purge = get_caches_to_be_purged(caches_dir, caches_in_use, args.threshold_days) caches_to_keep = all_caches - caches_to_purge - may_be_perform_purging(caches_to_purge, caches_to_keep, cache_type, dry_run) + may_be_perform_purging(caches_to_purge, caches_to_keep, cache_type, args.dry_run) print("Done!\n") def generate_sha1sum_emoji(zulip_path):