Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
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 /state_ids federation API #979
Conversation
erikjohnston
assigned
NegativeMjark
Aug 3, 2016
NegativeMjark
commented on the diff
Aug 3, 2016
synapse/federation/federation_client.py
| + state_event_ids = result["pdus"] | ||
| + auth_event_ids = result.get("auth_chain", []) | ||
| + | ||
| + event_map, _failed_to_fetch = yield self.get_events( | ||
| + [destination], room_id, set(state_event_ids + auth_event_ids) | ||
| + ) | ||
| + | ||
| + pdus = [event_map[e_id] for e_id in state_event_ids] | ||
| + auth_chain = [event_map[e_id] for e_id in auth_event_ids] | ||
| + | ||
| + auth_chain.sort(key=lambda e: e.depth) | ||
| + | ||
| + defer.returnValue((pdus, auth_chain)) | ||
| + except HttpResponseException as e: | ||
| + if e.code == 404: | ||
| + logger.info("Failed to use get_room_state_ids API, falling back") |
NegativeMjark
Contributor
|
NegativeMjark
and 1 other
commented on an outdated diff
Aug 3, 2016
synapse/federation/federation_client.py
| + defer.returnValue((signed_events, failed_to_fetch)) | ||
| + | ||
| + def random_server_list(): | ||
| + srvs = list(destinations) | ||
| + random.shuffle(srvs) | ||
| + return srvs | ||
| + | ||
| + batch_size = 20 | ||
| + for i in xrange(0, len(missing_events), batch_size): | ||
| + batch = missing_events[i:i + batch_size] | ||
| + | ||
| + deferreds = [ | ||
| + self.get_pdu( | ||
| + destinations=random_server_list(), | ||
| + event_id=e_id, | ||
| + ).addBoth(lambda r, e: (r, e), e_id) |
|
|
erikjohnston
added some commits
Aug 3, 2016
erikjohnston
referenced this pull request
in matrix-org/sytest
Aug 3, 2016
Merged
Test new /state_ids API #278
NegativeMjark
commented on an outdated diff
Aug 3, 2016
synapse/federation/federation_client.py
| + return srvs | ||
| + | ||
| + batch_size = 20 | ||
| + for i in xrange(0, len(missing_events), batch_size): | ||
| + batch = missing_events[i:i + batch_size] | ||
| + | ||
| + deferreds = [ | ||
| + self.get_pdu( | ||
| + destinations=random_server_list(), | ||
| + event_id=e_id, | ||
| + ).addBoth(lambda r, e: (r, e), e_id) | ||
| + for e_id in batch | ||
| + ] | ||
| + | ||
| + res = yield defer.DeferredList(deferreds, consumeErrors=True) | ||
| + for (result, val), (e_id, _) in res: |
NegativeMjark
Contributor
|
erikjohnston
added some commits
Aug 3, 2016
|
LGTM |
erikjohnston
added some commits
Aug 4, 2016
erikjohnston
merged commit 1b5436a
into
develop
Aug 4, 2016
10 checks passed
Flake8 + Packaging (Commit)
Build #1359 origin/erikj/state_ids_api succeeded in 37 sec
Details
Flake8 + Packaging (Merged PR)
Build finished.
Details
Sytest Dendron (Commit)
Build #458 origin/erikj/state_ids_api succeeded in 9 min 8 sec
Details
Sytest Dendron (Merged PR)
Build finished.
Details
Sytest Postgres (Commit)
Build #1291 origin/erikj/state_ids_api succeeded in 6 min 32 sec
Details
Sytest Postgres (Merged PR)
Build finished.
Details
Sytest SQLite (Commit)
Build #1324 origin/erikj/state_ids_api succeeded in 5 min 35 sec
Details
Sytest SQLite (Merged PR)
Build finished.
Details
Unit Tests (Commit)
Build #1396 origin/erikj/state_ids_api succeeded in 2 min 39 sec
Details
Unit Tests (Merged PR)
Build finished.
Details
richvdh
deleted the
erikj/state_ids_api
branch
Dec 1, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
erikjohnston commentedAug 3, 2016
The new API only returns the event_ids for the state, as most requesters will already have the vast majority of the events already.