purge-old-deployments: Use the `clean_unused_caches.main` function.

We currently run the `clean_unused_caches.py` as a
script to clean the unused caches.

This commit replaces that with
`clean_unused_caches.main` function as it would be
faster.
This commit is contained in:
Riken Shah 2021-06-12 06:31:50 +00:00 committed by Tim Abbott
parent 45af71e33b
commit c5580607a7
1 changed files with 2 additions and 3 deletions

View File

@ -7,6 +7,7 @@ from typing import Set
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(ZULIP_PATH)
from scripts.lib import clean_unused_caches
from scripts.lib.zulip_tools import (
DEPLOYMENTS_DIR,
get_recent_deployments,
@ -86,9 +87,7 @@ def main() -> None:
print("Cleaning orphaned/unused caches...")
# Call 'clean_unused_caches.py' script to clean any orphaned/unused caches.
subprocess.check_call(
[os.path.join(ZULIP_PATH, "scripts/lib/clean_unused_caches.py"), *sys.argv[1:]]
)
clean_unused_caches.main(args)
print("Done!")