diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-08-22 17:00:10 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-08-22 17:00:10 +0100 |
commit | 1379dcae6fb30c772fd77d68b27833fb7f418104 (patch) | |
tree | 145a0503a56336da9f25e2817f4dd87e2c8e01a7 /synapse/federation/handler.py | |
parent | Merge branch 'master' of github.com:matrix-org/synapse into develop (diff) | |
download | synapse-1379dcae6fb30c772fd77d68b27833fb7f418104.tar.xz |
Take a snapshot of the state of the room before performing updates
Diffstat (limited to 'synapse/federation/handler.py')
-rw-r--r-- | synapse/federation/handler.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/synapse/federation/handler.py b/synapse/federation/handler.py index 984c1558e9..ce98f4f94a 100644 --- a/synapse/federation/handler.py +++ b/synapse/federation/handler.py @@ -51,19 +51,20 @@ class FederationEventHandler(object): @log_function @defer.inlineCallbacks - def handle_new_event(self, event): + def handle_new_event(self, event, snapshot): """ Takes in an event from the client to server side, that has already been authed and handled by the state module, and sends it to any remote home servers that may be interested. Args: event + snapshot (.storage.Snapshot): THe snapshot the event happened after Returns: Deferred: Resolved when it has successfully been queued for processing. """ - yield self.fill_out_prev_events(event) + yield self.fill_out_prev_events(event, snapshot) pdu = self.pdu_codec.pdu_from_event(event) @@ -137,13 +138,11 @@ class FederationEventHandler(object): yield self.event_handler.on_receive(new_state_event) @defer.inlineCallbacks - def fill_out_prev_events(self, event): + def fill_out_prev_events(self, event, snapshot): if hasattr(event, "prev_events"): return - results = yield self.store.get_latest_pdus_in_context( - event.room_id - ) + results = snapshot.prev_pdus es = [ "%s@%s" % (p_id, origin) for p_id, origin, _ in results |