snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
This commit is contained in:
48
scripts/lib/clean_emoji_cache.py
Executable file
48
scripts/lib/clean_emoji_cache.py
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
sys.path.append(ZULIP_PATH)
|
||||
from scripts.lib.zulip_tools import (
|
||||
get_environment,
|
||||
get_recent_deployments,
|
||||
parse_cache_script_args,
|
||||
purge_unused_caches,
|
||||
)
|
||||
|
||||
ENV = get_environment()
|
||||
EMOJI_CACHE_PATH = "/srv/zulip-emoji-cache"
|
||||
|
||||
|
||||
def get_caches_in_use(threshold_days: int) -> set[str]:
|
||||
setups_to_check = {ZULIP_PATH}
|
||||
caches_in_use = set()
|
||||
|
||||
if ENV == "prod":
|
||||
setups_to_check |= get_recent_deployments(threshold_days)
|
||||
if ENV == "dev":
|
||||
CACHE_SYMLINK = os.path.join(ZULIP_PATH, "static", "generated", "emoji")
|
||||
CURRENT_CACHE = os.path.dirname(os.path.realpath(CACHE_SYMLINK))
|
||||
caches_in_use.add(CURRENT_CACHE)
|
||||
|
||||
for setup_dir in setups_to_check:
|
||||
emoji_link_path = os.path.join(setup_dir, "static/generated/emoji")
|
||||
if not os.path.islink(emoji_link_path):
|
||||
# This happens for a deployment directory extracted from a
|
||||
# tarball, which just has a copy of the emoji data, not a symlink.
|
||||
continue
|
||||
# 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:
|
||||
caches_in_use = get_caches_in_use(args.threshold_days)
|
||||
purge_unused_caches(EMOJI_CACHE_PATH, caches_in_use, "emoji cache", args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parse_cache_script_args("This script cleans unused Zulip emoji caches.")
|
||||
main(args)
|
||||
Reference in New Issue
Block a user