upgrade: Copy cache prefix with --skip-tornado.

Because Tornado and Django use memcached as a shared cache for
checking session information, they must agree on the prefix used to
store those values.

Subsequent commits will work to ensure that it is always _safe_ to
share that cache.
This commit is contained in:
Alex Vandiver 2022-05-02 18:20:37 -07:00 committed by Tim Abbott
parent fa77be6e6c
commit ef7c2ea0ea
1 changed files with 6 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import hashlib
import logging import logging
import os import os
import re import re
import shutil
import subprocess import subprocess
import sys import sys
import time import time
@ -268,8 +269,6 @@ if os.path.exists(emoji_path):
emoji_data = f.read() emoji_data = f.read()
emoji_sha = hashlib.sha1(emoji_data).hexdigest() emoji_sha = hashlib.sha1(emoji_data).hexdigest()
if emoji_sha == "47033121dc20b376e0f86f4916969872ad22a293": if emoji_sha == "47033121dc20b376e0f86f4916969872ad22a293":
import shutil
shutil.rmtree("/home/zulip/prod-static/generated/emoji/images-google-64") shutil.rmtree("/home/zulip/prod-static/generated/emoji/images-google-64")
# And then, building/installing the static assets. # And then, building/installing the static assets.
@ -341,6 +340,11 @@ elif not args.skip_migrations:
if line_str.startswith("[ ]"): if line_str.startswith("[ ]"):
migrations_needed = True migrations_needed = True
# If we're skipping tornado restarts, we need to ensure we keep the
# same cache prefix as we currently have.
if args.skip_tornado:
shutil.copyfile("../current/var/remote_cache_prefix", "./var/remote_cache_prefix")
# If there are no migrations needed, we can fill the caches now, # If there are no migrations needed, we can fill the caches now,
# instead of after they run. # instead of after they run.
if not migrations_needed: if not migrations_needed: