diff options
author | Erik Johnston <erik@matrix.org> | 2015-01-06 11:18:02 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-01-06 11:18:02 +0000 |
commit | d7e8ea67b374d3b006f7277de531302abc410e57 (patch) | |
tree | 4d3cb1092085fe28e19c00b6a1cf8d840ec6d7ee /synapse | |
parent | Add RoomMemberStore.get_users_in_room, so that we can get the list of joined ... (diff) | |
download | synapse-d7e8ea67b374d3b006f7277de531302abc410e57.tar.xz |
Reformat
Diffstat (limited to '')
-rw-r--r-- | synapse/storage/_base.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py index a6e2e0e2ef..a30b0bc410 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py @@ -440,15 +440,16 @@ class SQLBaseStore(object): ) def _get_events_txn(self, txn, event_ids): - if not event_ids: - return [] + if not event_ids: + return [] - if len(event_ids) > 50: - events = [] - n = 50 - for e_ids in [event_ids[i:i + n] for i in range(0, len(event_ids), n)]: - events.extend(self._get_events_txn(txn, e_ids)) - return events + if len(event_ids) > 50: + events = [] + n = 50 + split = [event_ids[i:i + n] for i in range(0, len(event_ids), n)] + for e_ids in split: + events.extend(self._get_events_txn(txn, e_ids)) + return events where_clause = " OR ".join(["e.event_id = ?" for _ in event_ids]) @@ -482,13 +483,13 @@ class SQLBaseStore(object): internal_metadata, js, redacted = res - return self._get_event_from_row_txn( - txn, internal_metadata, js, redacted, check_redacted=check_redacted, - get_prev_content=get_prev_content, - ) + return self._get_event_from_row_txn( + txn, internal_metadata, js, redacted, check_redacted=check_redacted, + get_prev_content=get_prev_content, + ) def _get_event_from_row_txn(self, txn, internal_metadata, js, redacted, - check_redacted=True, get_prev_content=True): + check_redacted=True, get_prev_content=True): d = json.loads(js) internal_metadata = json.loads(internal_metadata) |