Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

sharding: Use restart-server after setting up new sharding config.

Alex Vandivere18b0fcd1656
diff --git a/scripts/refresh-sharding-and-restart b/scripts/refresh-sharding-and-restart
index 14c0ec9caaf..26c7e9af806 100755
--- a/scripts/refresh-sharding-and-restart
+++ b/scripts/refresh-sharding-and-restart
@@ -16,21 +16,17 @@ mv /etc/zulip/nginx_sharding_map.conf.tmp /etc/zulip/nginx_sharding_map.conf
mv /etc/zulip/sharding.json.tmp /etc/zulip/sharding.json
# In the ordering of operations below, the crucial detail is that
-# zulip-django and zulip-workers:* need to be restarted before
-# reloading nginx. Django has an in-memory map of which realm belongs
+# Django, Tornado, and workers need to be restarted before reloading
+# nginx. Django and Tornado have in-memory maps of which realm belongs
# to which shard. Reloading nginx will cause users' tornado requests
# to be routed according to the new sharding scheme. If that happens
# before Django is restarted, updating its realm->shard map, users on
-# realms, whose shard has changed, will have their tornado requests
+# realms whose shard has changed will have their tornado requests
# handled by the new tornado process, while Django will still use the
# old process for its internal communication with tornado when
# servicing the user's requests. That's a bad state that leads to
# clients getting into reload loops ending in crashing on 500 response
# while Django is restarting. For this reason it's important to
-# reload nginx only after Django.
-supervisorctl restart zulip-django
-supervisorctl restart 'zulip-workers:*'
-if [ -f /etc/supervisor/conf.d/zulip/zulip-once.conf ]; then
- supervisorctl restart zulip_deliver_scheduled_emails zulip_deliver_scheduled_messages
-fi
+# reload nginx only after Django and Tornado.
+"$(dirname "$0")/restart-server" --skip-client-reloads
service nginx reload