mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Actually, we probably want to run this in a transaction
This commit is contained in:
parent
2f7f8e1c2b
commit
656223fbd3
@ -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.
|
||||
res = yield self.runInteraction("_get_events", get_missing)
|
||||
defer.returnValue(res)
|
||||
|
||||
defer.returnValue(get_missing())
|
||||
]
|
||||
|
||||
if not txn:
|
||||
res = yield self.runInteraction("_get_events", get_missing)
|
||||
defer.returnValue(res)
|
||||
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 New Issue
Block a user