mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-27 21:49:26 -05:00
Merge pull request #180 from matrix-org/erikj/prev_state_context
Don't needlessly compute prev_state
This commit is contained in:
commit
3bbd0d0e09
@ -78,7 +78,9 @@ class BaseHandler(object):
|
|||||||
context = yield state_handler.compute_event_context(builder)
|
context = yield state_handler.compute_event_context(builder)
|
||||||
|
|
||||||
if builder.is_state():
|
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)
|
yield self.auth.add_auth_events(builder, context)
|
||||||
|
|
||||||
|
@ -169,10 +169,6 @@ class StateHandler(object):
|
|||||||
context.current_state = curr_state
|
context.current_state = curr_state
|
||||||
context.state_group = group if not event.is_state() else None
|
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():
|
if event.is_state():
|
||||||
key = (event.type, event.state_key)
|
key = (event.type, event.state_key)
|
||||||
if key in context.current_state:
|
if key in context.current_state:
|
||||||
|
@ -42,6 +42,7 @@ class RoomMemberHandlerTestCase(unittest.TestCase):
|
|||||||
"get_room",
|
"get_room",
|
||||||
"store_room",
|
"store_room",
|
||||||
"get_latest_events_in_room",
|
"get_latest_events_in_room",
|
||||||
|
"add_event_hashes",
|
||||||
]),
|
]),
|
||||||
resource_for_federation=NonCallableMock(),
|
resource_for_federation=NonCallableMock(),
|
||||||
http_client=NonCallableMock(spec_set=[]),
|
http_client=NonCallableMock(spec_set=[]),
|
||||||
@ -88,6 +89,7 @@ class RoomMemberHandlerTestCase(unittest.TestCase):
|
|||||||
self.ratelimiter.send_message.return_value = (True, 0)
|
self.ratelimiter.send_message.return_value = (True, 0)
|
||||||
|
|
||||||
self.datastore.persist_event.return_value = (1,1)
|
self.datastore.persist_event.return_value = (1,1)
|
||||||
|
self.datastore.add_event_hashes.return_value = []
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_invite(self):
|
def test_invite(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user