restart-server: All realm Tornado ports need a restart when they change.

This commit is contained in:
Alex Vandiver
2025-10-15 14:27:22 +00:00
committed by Tim Abbott
parent 21f08265de
commit a8f0cb2cf9

View File

@@ -195,7 +195,12 @@ def update_tornado_sharding() -> list[int]:
for realm in set().union(old_sharding["shard_map"], new_sharding["shard_map"]):
old_ports = ports_as_set(old_sharding["shard_map"].get(realm, []))
new_ports = ports_as_set(new_sharding["shard_map"].get(realm, []))
affected_tornados |= old_ports ^ new_ports
if old_ports != new_ports:
# A realm sharded across multiple ports gets requests at
# random from nginx, and each does an X-Accel-Redirect to
# the user's right Tornado instance. So all ports in the
# set need a restart when we add or remove ports.
affected_tornados |= old_ports | new_ports
old_regex_set = {
(regex, ports_as_set(ports)) for (regex, ports) in old_sharding["shard_regexes"]
}