mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-22 12:44:57 -05:00
Fix bug in _get_auth_chain_txn
This commit is contained in:
parent
3cb678f84c
commit
16a0815fac
@ -32,24 +32,21 @@ class EventFederationStore(SQLBaseStore):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _get_auth_chain_txn(self, txn, event_id):
|
def _get_auth_chain_txn(self, txn, event_id):
|
||||||
results = set([event_id])
|
results = set()
|
||||||
|
|
||||||
|
base_sql = (
|
||||||
|
"SELECT auth_id FROM event_auth WHERE %s"
|
||||||
|
)
|
||||||
|
|
||||||
front = set([event_id])
|
front = set([event_id])
|
||||||
while front:
|
while front:
|
||||||
for ev_id in front:
|
sql = base_sql % (
|
||||||
new_front = set()
|
" OR ".join(["event_id=?"] * len(front)),
|
||||||
auth_ids = self._simple_select_onecol_txn(
|
|
||||||
txn,
|
|
||||||
table="event_auth",
|
|
||||||
keyvalues={
|
|
||||||
"event_id": ev_id,
|
|
||||||
},
|
|
||||||
retcol="auth_id",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
new_front.update(auth_ids)
|
txn.execute(sql, list(front))
|
||||||
front = new_front
|
front = [r[0] for r in txn.fetchall()]
|
||||||
new_front.clear()
|
results.update(front)
|
||||||
|
|
||||||
sql = "SELECT * FROM events WHERE event_id = ?"
|
sql = "SELECT * FROM events WHERE event_id = ?"
|
||||||
rows = []
|
rows = []
|
||||||
|
Loading…
Reference in New Issue
Block a user