mirror of https://github.com/zulip/zulip.git
Fill memcached caches synchronously before restarting the server
(imported from commit a45fa845e94a1fc6e96a1aafca31e9a6fc2b7526)
This commit is contained in:
parent
2f7f0da27f
commit
300e57fcbd
|
@ -16,6 +16,9 @@ os.chdir("/home/humbug/humbug-deployments/current")
|
||||||
# Send a statsd event on restarting the server
|
# Send a statsd event on restarting the server
|
||||||
subprocess.check_call(["python", "./manage.py", "send_stats", "incr", "events.server_restart", str(int(time.time()))])
|
subprocess.check_call(["python", "./manage.py", "send_stats", "incr", "events.server_restart", str(int(time.time()))])
|
||||||
|
|
||||||
|
logging.info("Filling memcached caches")
|
||||||
|
subprocess.check_call(["python", "./manage.py", "fill_memcached_caches"])
|
||||||
|
|
||||||
# Restart the FastCGI and related processes via supervisorctl. We
|
# Restart the FastCGI and related processes via supervisorctl. We
|
||||||
# minimize downtime by restarting Django and Tornado separately from
|
# minimize downtime by restarting Django and Tornado separately from
|
||||||
# the other worker processes.
|
# the other worker processes.
|
||||||
|
@ -26,17 +29,5 @@ subprocess.check_call(["supervisorctl", "restart", "humbug-tornado"])
|
||||||
subprocess.check_call(["supervisorctl", "start", "humbug-django"])
|
subprocess.check_call(["supervisorctl", "start", "humbug-django"])
|
||||||
subprocess.check_call(["supervisorctl", "start", "humbug-workers:*"])
|
subprocess.check_call(["supervisorctl", "start", "humbug-workers:*"])
|
||||||
|
|
||||||
logging.info("Flushing memcached")
|
|
||||||
try:
|
|
||||||
if not pylibmc.Client(['127.0.0.1']).flush_all():
|
|
||||||
print "%sflush_all returned False%s" % (WARNING, ENDC)
|
|
||||||
# There doesn't seem to be a method to close a pylibmc Client object.
|
|
||||||
except:
|
|
||||||
print "%sCould not flush cache:%s" % (WARNING, ENDC)
|
|
||||||
traceback.print_exc()
|
|
||||||
|
|
||||||
logging.info("Refilling memcached caches")
|
|
||||||
subprocess.check_call(["python", "./manage.py", "fill_memcached_caches"])
|
|
||||||
|
|
||||||
logging.info("Done!")
|
logging.info("Done!")
|
||||||
print OKGREEN + "Application restarted successfully!" + ENDC
|
print OKGREEN + "Application restarted successfully!" + ENDC
|
||||||
|
|
|
@ -16,6 +16,5 @@ class Command(BaseCommand):
|
||||||
return fill_memcached_cache(options["cache"])
|
return fill_memcached_cache(options["cache"])
|
||||||
|
|
||||||
for cache in cache_fillers.keys():
|
for cache in cache_fillers.keys():
|
||||||
subprocess.Popen(["python", os.path.join(os.path.dirname(__file__), "../../..", "manage.py"),
|
fill_memcached_cache(cache)
|
||||||
"fill_memcached_caches", "--cache", cache])
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue