mirror of https://github.com/zulip/zulip.git
scripts: Rearrange the arguments of `purge_unused_caches()`.
This commit re-arranges the arguments of `purge_unused_caches()` function in order to remain consistent with other similar functions in the library like `may_be_perform_caching()`.
This commit is contained in:
parent
df7ea375c1
commit
57161a92a1
|
@ -44,7 +44,7 @@ def main():
|
|||
args = parse_cache_script_args("This script cleans unused zulip emoji caches.")
|
||||
caches_in_use = get_caches_in_use(args.threshold_days)
|
||||
purge_unused_caches(
|
||||
EMOJI_CACHE_PATH, caches_in_use, args, "emoji cache")
|
||||
EMOJI_CACHE_PATH, caches_in_use, "emoji cache", args)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -54,7 +54,7 @@ def main():
|
|||
args = parse_cache_script_args("This script cleans unused zulip npm caches.")
|
||||
caches_in_use = get_caches_in_use(args.threshold_days)
|
||||
purge_unused_caches(
|
||||
NODE_MODULES_CACHE_PATH, caches_in_use, args, "node modules cache")
|
||||
NODE_MODULES_CACHE_PATH, caches_in_use, "node modules cache", args)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -44,7 +44,7 @@ def main():
|
|||
args = parse_cache_script_args("This script cleans unused zulip venv caches.")
|
||||
caches_in_use = get_caches_in_use(args.threshold_days)
|
||||
purge_unused_caches(
|
||||
VENV_CACHE_DIR, caches_in_use, args, "venv cache")
|
||||
VENV_CACHE_DIR, caches_in_use, "venv cache", args)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -231,8 +231,8 @@ 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, args, cache_type):
|
||||
# type: (Text, Set[Text], argparse.Namespace, Text) -> None
|
||||
def purge_unused_caches(caches_dir, caches_in_use, cache_type, args):
|
||||
# type: (Text, Set[Text], Text, argparse.Namespace) -> 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, args.threshold_days)
|
||||
caches_to_keep = all_caches - caches_to_purge
|
||||
|
|
Loading…
Reference in New Issue