mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-21 11:03:54 +01:00
Actually, we probably want to run this in a transaction
This commit is contained in:
parent
2f7f8e1c2b
commit
656223fbd3
1 changed files with 12 additions and 15 deletions
|
@ -881,32 +881,29 @@ class SQLBaseStore(object):
|
|||
allow_rejected=allow_rejected,
|
||||
)
|
||||
|
||||
missing_events = [e for e in event_ids if e not in event_map]
|
||||
missing_events_ids = [e for e in event_ids if e not in event_map]
|
||||
|
||||
def get_missing(txn=None):
|
||||
missing_events = yield self._fetch_events(
|
||||
def get_missing(txn):
|
||||
missing_events = unwrap_deferred(self._fetch_events(
|
||||
txn,
|
||||
missing_events,
|
||||
missing_events_ids,
|
||||
check_redacted=check_redacted,
|
||||
get_prev_content=get_prev_content,
|
||||
allow_rejected=allow_rejected,
|
||||
)
|
||||
))
|
||||
|
||||
event_map.update(missing_events)
|
||||
|
||||
defer.returnValue([
|
||||
return [
|
||||
event_map[e_id] for e_id in event_ids
|
||||
if e_id in event_map and event_map[e_id]
|
||||
])
|
||||
]
|
||||
|
||||
if missing_events and get_prev_content and not txn:
|
||||
if get_prev_content and not txn:
|
||||
# If we want prev_content then lets just jump into a txn.
|
||||
if not txn:
|
||||
res = yield self.runInteraction("_get_events", get_missing)
|
||||
defer.returnValue(res)
|
||||
|
||||
defer.returnValue(get_missing())
|
||||
|
||||
else:
|
||||
defer.returnValue(get_missing(txn))
|
||||
|
||||
def _get_events_txn(self, txn, event_ids, check_redacted=True,
|
||||
get_prev_content=False, allow_rejected=False):
|
||||
|
|
Loading…
Reference in a new issue