Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add secondary_directory_servers option to fetch room list from other servers #808

Merged
merged 9 commits into from Jun 1, 2016

Conversation

Projects
None yet
3 participants
Member

dbkr commented May 31, 2016

This polls the list of remote servers for their lists every minute, returning the cached results from the last successful fetch (since server restart). If there is no cached result, it will wait for any currently running poll to complete before returning the result.

We probably want an additional cache somewhere to reduce the load from producing the local room list, which I suspect will be a cache of the whole aggregated room list. If so, this probably belongs in a separate PR.

dbkr added some commits May 31, 2016

Add vector.im to default secondary_directory_servers and add comment …
…explaining it's not a permanent solution
Add cache to remote room lists
Poll for updates from remote servers, waiting for the poll if there's no cache entry.

dbkr added some commits Jun 1, 2016

Inject fake room list handler in tests
Otherwise it tries to start the remote public room list updating looping call which breaks.

@dbkr dbkr commented on the diff Jun 1, 2016

synapse/handlers/room.py
+ logger.warn("No cached room list from %s: waiting for fetch", s)
+ wait = True
+ break
+
+ if wait and self.remote_list_request_cache.get(()):
+ yield self.remote_list_request_cache.get(())
+
+ public_rooms = yield self.get_local_public_room_list()
+
+ # keep track of which room IDs we've seen so we can de-dup
+ room_ids = set()
+
+ # tag all the ones in our list with our server name.
+ # Also add the them to the de-deping set
+ for room in public_rooms['chunk']:
+ room["server_name"] = self.hs.hostname
@dbkr

dbkr Jun 1, 2016

Member

Is this actually necessary or is it, by definition, the domain part of the published alias?

@erikjohnston

erikjohnston Jun 1, 2016

Owner

Not all published rooms will have aliases, and even those that do may have aliases from servers other than the server (e.g., you can have a single room being published to multiple lists)

@dbkr

dbkr Jun 1, 2016

Member

Oh, of course :)

Owner

erikjohnston commented Jun 1, 2016

LGTM

Contributor

NegativeMjark commented Jun 1, 2016

LGTM

@dbkr dbkr merged commit 00c487a into develop Jun 1, 2016

8 checks passed

Flake8 + Packaging (Commit) Build #791 origin/dbkr/room_list_spider succeeded in 29 sec
Details
Flake8 + Packaging (Merged PR) Build finished.
Details
Sytest Postgres (Commit) Build #768 origin/dbkr/room_list_spider succeeded in 4 min 20 sec
Details
Sytest Postgres (Merged PR) Build finished.
Details
Sytest SQLite (Commit) Build #775 origin/dbkr/room_list_spider succeeded in 3 min 11 sec
Details
Sytest SQLite (Merged PR) Build finished.
Details
Unit Tests (Commit) Build #832 origin/dbkr/room_list_spider succeeded in 1 min 29 sec
Details
Unit Tests (Merged PR) Build finished.
Details

@richvdh richvdh deleted the dbkr/room_list_spider branch Dec 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment