summary refs log tree commit diff
path: root/synapse/handlers/federation.py
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2015-12-10 17:18:46 +0000
committerDavid Baker <dave@matrix.org>2015-12-10 17:18:46 +0000
commita84a6933274c0da64c41ac494b027ab5010a4801 (patch)
treec3cb93da7d626a6c45c50e2b980ec8e90bf20d1e /synapse/handlers/federation.py
parentVery first cut of calculating actions for events as they come in. Doesn't sto... (diff)
downloadsynapse-a84a6933274c0da64c41ac494b027ab5010a4801.tar.xz
Having consulted The Erikle, this should go at the end of on_receive_pdu, otherwise it will be triggered whenever we backfill too.
Diffstat (limited to 'synapse/handlers/federation.py')
-rw-r--r--synapse/handlers/federation.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 18289eb529..6a4269b500 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -244,6 +244,12 @@ class FederationHandler(BaseHandler):
                     user = UserID.from_string(event.state_key)
                     yield user_joined_room(self.distributor, user, event.room_id)
 
+        if not backfilled and not event.internal_metadata.is_outlier():
+            action_generator = ActionGenerator(self.store)
+            yield action_generator.handle_event(serialize_event(
+                event, self.clock.time_msec())
+            )
+
     @defer.inlineCallbacks
     def _filter_events_for_server(self, server_name, room_id, events):
         event_to_state = yield self.store.get_state_for_events(
@@ -1115,11 +1121,6 @@ class FederationHandler(BaseHandler):
             current_state=current_state,
         )
 
-        action_generator = ActionGenerator(self.store)
-        yield action_generator.handle_event(serialize_event(
-            event, self.clock.time_msec())
-        )
-
         defer.returnValue((context, event_stream_id, max_stream_id))
 
     @defer.inlineCallbacks
@@ -1146,12 +1147,6 @@ class FederationHandler(BaseHandler):
             is_new_state=(not outliers and not backfilled),
         )
 
-        for ev_info in event_infos:
-            action_generator = ActionGenerator(self.store)
-            yield action_generator.handle_event(serialize_event(
-                ev_info["event"], self.clock.time_msec())
-            )
-
     @defer.inlineCallbacks
     def _persist_auth_tree(self, auth_events, state, event):
         """Checks the auth chain is valid (and passes auth checks) for the