mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-01-31 08:53:21 -05:00
Preemptively jump into a transaction if we ask for get_prev_content
This commit is contained in:
parent
e1e9f0c5b2
commit
2f7f8e1c2b
@ -883,6 +883,7 @@ class SQLBaseStore(object):
|
|||||||
|
|
||||||
missing_events = [e for e in event_ids if e not in event_map]
|
missing_events = [e for e in event_ids if e not in event_map]
|
||||||
|
|
||||||
|
def get_missing(txn=None):
|
||||||
missing_events = yield self._fetch_events(
|
missing_events = yield self._fetch_events(
|
||||||
txn,
|
txn,
|
||||||
missing_events,
|
missing_events,
|
||||||
@ -898,6 +899,15 @@ class SQLBaseStore(object):
|
|||||||
if e_id in event_map and event_map[e_id]
|
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())
|
||||||
|
|
||||||
|
|
||||||
def _get_events_txn(self, txn, event_ids, check_redacted=True,
|
def _get_events_txn(self, txn, event_ids, check_redacted=True,
|
||||||
get_prev_content=False, allow_rejected=False):
|
get_prev_content=False, allow_rejected=False):
|
||||||
return unwrap_deferred(self._get_events(
|
return unwrap_deferred(self._get_events(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user