diff options
author | Erik Johnston <erik@matrix.org> | 2015-06-22 17:41:42 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-06-22 17:41:42 +0100 |
commit | be29e152d101a40310c6f6e6eb83945b24d8a568 (patch) | |
tree | 3cec24bad7714b37ad1b713a4711bb3b0737a416 | |
parent | Only persist a maximum of 100 events at a time (diff) | |
download | synapse-be29e152d101a40310c6f6e6eb83945b24d8a568.tar.xz |
Don't update current_state_events for outliers
-rw-r--r-- | synapse/handlers/federation.py | 18 | ||||
-rw-r--r-- | synapse/storage/events.py | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index d20deb2edc..a4186443d8 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -156,7 +156,11 @@ class FederationHandler(BaseHandler): }] seen_ids.add(e.event_id) - yield self._handle_new_events(origin, event_infos) + yield self._handle_new_events( + origin, + event_infos, + outliers=True + ) try: _, event_stream_id, max_stream_id = yield self._handle_new_event( @@ -613,7 +617,7 @@ class FederationHandler(BaseHandler): } }) - yield self._handle_new_events(origin, ev_infos) + yield self._handle_new_events(origin, ev_infos, outliers=True) auth_ids = [e_id for e_id, _ in event.auth_events] auth_events = { @@ -994,8 +998,8 @@ class FederationHandler(BaseHandler): defer.returnValue((context, event_stream_id, max_stream_id)) @defer.inlineCallbacks - def _handle_new_events(self, origin, event_infos, backfilled=False): - logger.debug("_handle_new_events: %r", event_infos) + def _handle_new_events(self, origin, event_infos, backfilled=False, + outliers=False): contexts = yield defer.gatherResults( [ self._prep_event( @@ -1009,19 +1013,15 @@ class FederationHandler(BaseHandler): ] ) - logger.debug("_handle_new_events2: %d, %d", len(event_infos), len(contexts)) - yield self.store.persist_events( [ (ev_info["event"], context) for ev_info, context in itertools.izip(event_infos, contexts) ], backfilled=backfilled, - is_new_state=(not backfilled), + is_new_state=(not outliers and not backfilled), ) - logger.debug("_handle_new_events3: %r", event_infos) - @defer.inlineCallbacks def _prep_event(self, origin, event, state=None, backfilled=False, current_state=None, auth_events=None): diff --git a/synapse/storage/events.py b/synapse/storage/events.py index f9984b7444..29491dc947 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -675,7 +675,7 @@ class EventsStore(SQLBaseStore): if is_new_state: for event, _ in state_events_and_contexts: - if not context.rejected: + if not context.rejected and not event.internal_metadata.is_outlier(): txn.call_after( self.get_current_state_for_key.invalidate, event.room_id, event.type, event.state_key |