mirror of
https://github.com/element-hq/synapse
synced 2024-09-04 10:10:06 +00:00
Reformat
This commit is contained in:
parent
f0128f9600
commit
d7e8ea67b3
1 changed files with 14 additions and 13 deletions
|
@ -440,15 +440,16 @@ class SQLBaseStore(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
def _get_events_txn(self, txn, event_ids):
|
def _get_events_txn(self, txn, event_ids):
|
||||||
if not event_ids:
|
if not event_ids:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
if len(event_ids) > 50:
|
if len(event_ids) > 50:
|
||||||
events = []
|
events = []
|
||||||
n = 50
|
n = 50
|
||||||
for e_ids in [event_ids[i:i + n] for i in range(0, len(event_ids), n)]:
|
split = [event_ids[i:i + n] for i in range(0, len(event_ids), n)]
|
||||||
events.extend(self._get_events_txn(txn, e_ids))
|
for e_ids in split:
|
||||||
return events
|
events.extend(self._get_events_txn(txn, e_ids))
|
||||||
|
return events
|
||||||
|
|
||||||
where_clause = " OR ".join(["e.event_id = ?" for _ in event_ids])
|
where_clause = " OR ".join(["e.event_id = ?" for _ in event_ids])
|
||||||
|
|
||||||
|
@ -482,13 +483,13 @@ class SQLBaseStore(object):
|
||||||
|
|
||||||
internal_metadata, js, redacted = res
|
internal_metadata, js, redacted = res
|
||||||
|
|
||||||
return self._get_event_from_row_txn(
|
return self._get_event_from_row_txn(
|
||||||
txn, internal_metadata, js, redacted, check_redacted=check_redacted,
|
txn, internal_metadata, js, redacted, check_redacted=check_redacted,
|
||||||
get_prev_content=get_prev_content,
|
get_prev_content=get_prev_content,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _get_event_from_row_txn(self, txn, internal_metadata, js, redacted,
|
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)
|
d = json.loads(js)
|
||||||
internal_metadata = json.loads(internal_metadata)
|
internal_metadata = json.loads(internal_metadata)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue