diff options
author | Erik Johnston <erik@matrix.org> | 2015-02-04 15:02:23 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-02-04 15:02:23 +0000 |
commit | 95e2d2d36d6dfb7205c40fa8e59ef350f8096395 (patch) | |
tree | 671ed04da2afb1fe6dd41a75ff8c1facf551a282 /synapse/handlers | |
parent | Retry make_join (diff) | |
download | synapse-95e2d2d36d6dfb7205c40fa8e59ef350f8096395.tar.xz |
When returning lists of servers from alias lookups, put the current server first in the list
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/directory.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/handlers/directory.py b/synapse/handlers/directory.py index 58e9a91562..7b60921040 100644 --- a/synapse/handlers/directory.py +++ b/synapse/handlers/directory.py @@ -113,7 +113,16 @@ class DirectoryHandler(BaseHandler): ) extra_servers = yield self.store.get_joined_hosts_for_room(room_id) - servers = list(set(extra_servers) | set(servers)) + servers = set(extra_servers) | set(servers) + + # If this server is in the list of servers, return it first. + if self.server_name in servers: + servers = ( + [self.server_name] + + [s for s in servers if s != self.server_name] + ) + else: + servers = list(servers) defer.returnValue({ "room_id": room_id, |