restart-server: Fill memcached caches after clearing the cache.

Our previous code could in theory end up clearing the caches it had
just filled, if Tornado's cache filling work happened to be faster
than the memcached flush.

(imported from commit 48174aadad398fb7a7c917a1df765c1261b12a55)
This commit is contained in:
Tim Abbott 2013-03-13 14:11:35 -04:00
parent adb9c88151
commit 60c3cf826d
3 changed files with 8 additions and 3 deletions

View File

@ -38,4 +38,7 @@ except:
print "%sCould not flush cache:%s" % (WARNING, ENDC)
traceback.print_exc()
subprocess.check_call(["python", os.path.join(os.path.dirname(__file__), "..", "manage.py"),
"fill_memcached_caches"])
print OKGREEN + "Application restarted successfully!" + ENDC

View File

@ -113,9 +113,11 @@ def initialize_user_messages():
stream = streams[m.recipient.type_id]
add_stream_message(stream.realm.id, stream.name, m.id)
if not settings.DEPLOYED:
# Filling the memcached cache is a little slow, so do it in a child process.
# For DEPLOYED cases, we run this from restart_server.
subprocess.Popen(["python", os.path.join(os.path.dirname(__file__), "..", "manage.py"),
"fill_message_cache"])
"fill_memcached_caches"])
def add_user_message(user_profile_id, message_id):
add_table_message("user", user_profile_id, message_id)