diff options
author | Erik Johnston <erikj@jki.re> | 2016-09-15 13:27:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-15 13:27:09 +0100 |
commit | e457034e99d46d32e3d71eddb12cda07d8a0370e (patch) | |
tree | 2b3cc4cbf5a17a6de91c6f07e47b038b22186921 /synapse/federation/federation_client.py | |
parent | Merge pull request #1117 from matrix-org/erikj/fix_state (diff) | |
parent | By default limit /publicRooms to 100 entries (diff) | |
download | synapse-e457034e99d46d32e3d71eddb12cda07d8a0370e.tar.xz |
Merge pull request #1121 from matrix-org/erikj/public_room_paginate
Add pagination support to publicRooms
Diffstat (limited to 'synapse/federation/federation_client.py')
-rw-r--r-- | synapse/federation/federation_client.py | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py index 91bed4746f..f0a684fc13 100644 --- a/synapse/federation/federation_client.py +++ b/synapse/federation/federation_client.py @@ -24,7 +24,6 @@ from synapse.api.errors import ( CodeMessageException, HttpResponseException, SynapseError, ) from synapse.util import unwrapFirstError -from synapse.util.async import concurrently_execute from synapse.util.caches.expiringcache import ExpiringCache from synapse.util.logutils import log_function from synapse.util.logcontext import preserve_fn, preserve_context_over_deferred @@ -719,24 +718,11 @@ class FederationClient(FederationBase): raise RuntimeError("Failed to send to any server.") - @defer.inlineCallbacks - def get_public_rooms(self, destinations): - results_by_server = {} - - @defer.inlineCallbacks - def _get_result(s): - if s == self.server_name: - defer.returnValue() - - try: - result = yield self.transport_layer.get_public_rooms(s) - results_by_server[s] = result - except: - logger.exception("Error getting room list from server %r", s) - - yield concurrently_execute(_get_result, destinations, 3) + def get_public_rooms(self, destination, limit=None, since_token=None): + if destination == self.server_name: + return - defer.returnValue(results_by_server) + return self.transport_layer.get_public_rooms(destination, limit, since_token) @defer.inlineCallbacks def query_auth(self, destination, room_id, event_id, local_auth): |