diff options
author | Erik Johnston <erik@matrix.org> | 2015-06-03 17:20:56 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-06-03 17:20:56 +0100 |
commit | 3bbd0d0e09c973d1280fa1cee2722cb2b8e46c89 (patch) | |
tree | 7d779559e825db59ee73836f0a67d3a635a97519 | |
parent | Merge pull request #179 from matrix-org/erikj/state_group_outliers (diff) | |
parent | Don't needlessly compute prev_state (diff) | |
download | synapse-3bbd0d0e09c973d1280fa1cee2722cb2b8e46c89.tar.xz |
Merge pull request #180 from matrix-org/erikj/prev_state_context
Don't needlessly compute prev_state
-rw-r--r-- | synapse/handlers/_base.py | 4 | ||||
-rw-r--r-- | synapse/state.py | 4 | ||||
-rw-r--r-- | tests/handlers/test_room.py | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/synapse/handlers/_base.py b/synapse/handlers/_base.py index 833ff41377..d6c064b398 100644 --- a/synapse/handlers/_base.py +++ b/synapse/handlers/_base.py @@ -78,7 +78,9 @@ class BaseHandler(object): context = yield state_handler.compute_event_context(builder) if builder.is_state(): - builder.prev_state = context.prev_state_events + builder.prev_state = yield self.store.add_event_hashes( + context.prev_state_events + ) yield self.auth.add_auth_events(builder, context) diff --git a/synapse/state.py b/synapse/state.py index 8a635f1cc1..80da90a72c 100644 --- a/synapse/state.py +++ b/synapse/state.py @@ -169,10 +169,6 @@ class StateHandler(object): context.current_state = curr_state context.state_group = group if not event.is_state() else None - prev_state = yield self.store.add_event_hashes( - prev_state - ) - if event.is_state(): key = (event.type, event.state_key) if key in context.current_state: diff --git a/tests/handlers/test_room.py b/tests/handlers/test_room.py index a2d7635995..2a7553f982 100644 --- a/tests/handlers/test_room.py +++ b/tests/handlers/test_room.py @@ -42,6 +42,7 @@ class RoomMemberHandlerTestCase(unittest.TestCase): "get_room", "store_room", "get_latest_events_in_room", + "add_event_hashes", ]), resource_for_federation=NonCallableMock(), http_client=NonCallableMock(spec_set=[]), @@ -88,6 +89,7 @@ class RoomMemberHandlerTestCase(unittest.TestCase): self.ratelimiter.send_message.return_value = (True, 0) self.datastore.persist_event.return_value = (1,1) + self.datastore.add_event_hashes.return_value = [] @defer.inlineCallbacks def test_invite(self): |