mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 05:58:25 +00:00
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:
committed by
Tim Abbott
parent
df7ea375c1
commit
57161a92a1
@@ -44,7 +44,7 @@ def main():
|
|||||||
args = parse_cache_script_args("This script cleans unused zulip emoji caches.")
|
args = parse_cache_script_args("This script cleans unused zulip emoji caches.")
|
||||||
caches_in_use = get_caches_in_use(args.threshold_days)
|
caches_in_use = get_caches_in_use(args.threshold_days)
|
||||||
purge_unused_caches(
|
purge_unused_caches(
|
||||||
EMOJI_CACHE_PATH, caches_in_use, args, "emoji cache")
|
EMOJI_CACHE_PATH, caches_in_use, "emoji cache", args)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ def main():
|
|||||||
args = parse_cache_script_args("This script cleans unused zulip npm caches.")
|
args = parse_cache_script_args("This script cleans unused zulip npm caches.")
|
||||||
caches_in_use = get_caches_in_use(args.threshold_days)
|
caches_in_use = get_caches_in_use(args.threshold_days)
|
||||||
purge_unused_caches(
|
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__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ def main():
|
|||||||
args = parse_cache_script_args("This script cleans unused zulip venv caches.")
|
args = parse_cache_script_args("This script cleans unused zulip venv caches.")
|
||||||
caches_in_use = get_caches_in_use(args.threshold_days)
|
caches_in_use = get_caches_in_use(args.threshold_days)
|
||||||
purge_unused_caches(
|
purge_unused_caches(
|
||||||
VENV_CACHE_DIR, caches_in_use, args, "venv cache")
|
VENV_CACHE_DIR, caches_in_use, "venv cache", args)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
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)
|
caches_to_purge.add(cache_dir)
|
||||||
return caches_to_purge
|
return caches_to_purge
|
||||||
|
|
||||||
def purge_unused_caches(caches_dir, caches_in_use, args, cache_type):
|
def purge_unused_caches(caches_dir, caches_in_use, cache_type, args):
|
||||||
# type: (Text, Set[Text], argparse.Namespace, Text) -> None
|
# type: (Text, Set[Text], Text, argparse.Namespace) -> None
|
||||||
all_caches = set([os.path.join(caches_dir, cache) for cache in os.listdir(caches_dir)])
|
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_purge = get_caches_to_be_purged(caches_dir, caches_in_use, args.threshold_days)
|
||||||
caches_to_keep = all_caches - caches_to_purge
|
caches_to_keep = all_caches - caches_to_purge
|
||||||
|
|||||||
Reference in New Issue
Block a user