mirror of https://github.com/zulip/zulip.git
scripts: Add argparse option to `restart-zerver` for `--fill-cache`.
Nowm unless you specify `--fill-cache`, memcached caches will not be pre-filled after a server restart. This will be helpful when someone is in a hurry (e.g. if the server is down right now, or if he/she testing a configuration change in a newly setup server), it's best to just restart without pre-filling the cache. Fixes: #10900.
This commit is contained in:
parent
46f4e58782
commit
50ef91bb08
|
@ -4,4 +4,4 @@ USER=zulip
|
|||
|
||||
# Cron job to restart the Zulip server weekly, with the goal of
|
||||
# minimizing the impact of any memory leaks that we might grow.
|
||||
0 6 * * 7 zulip /home/zulip/deployments/current/scripts/restart-server
|
||||
0 6 * * 7 zulip /home/zulip/deployments/current/scripts/restart-server --fill-cache
|
||||
|
|
|
@ -177,7 +177,7 @@ if migrations_needed:
|
|||
subprocess.check_call(["./manage.py", "create_realm_internal_bots"], preexec_fn=su_to_zulip)
|
||||
|
||||
logging.info("Restarting Zulip...")
|
||||
subprocess.check_output(["./scripts/restart-server"], preexec_fn=su_to_zulip)
|
||||
subprocess.check_output(["./scripts/restart-server", "--fill-cache"], preexec_fn=su_to_zulip)
|
||||
logging.info("Upgrade complete!")
|
||||
|
||||
if not args.skip_purge_old_deployments:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import configparser
|
||||
import os
|
||||
import sys
|
||||
|
@ -14,6 +15,11 @@ logging.Formatter.converter = time.gmtime
|
|||
logging.basicConfig(format="%(asctime)s restart-server: %(message)s",
|
||||
level=logging.INFO)
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--fill-cache', action='store_true', dest='fill_cache', default=False,
|
||||
help='Fill the memcached caches')
|
||||
args = parser.parse_args()
|
||||
|
||||
deploy_path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))
|
||||
os.chdir(deploy_path)
|
||||
|
||||
|
@ -24,6 +30,7 @@ if pwd.getpwuid(os.getuid()).pw_name != "zulip":
|
|||
# Send a statsd event on restarting the server
|
||||
subprocess.check_call(["./manage.py", "send_stats", "incr", "events.server_restart", str(int(time.time()))])
|
||||
|
||||
if args.fill_cache:
|
||||
logging.info("Filling memcached caches")
|
||||
subprocess.check_call(["./manage.py", "fill_memcached_caches"])
|
||||
|
||||
|
|
Loading…
Reference in New Issue