This commit is contained in:
Erik Johnston 2015-01-06 11:18:02 +00:00
parent f0128f9600
commit d7e8ea67b3
1 changed files with 14 additions and 13 deletions

View File

@ -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)