mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-18 18:44:37 +01:00
Do the select and insert in a single transaction
This commit is contained in:
parent
99c4ec1eef
commit
5ceee46c6b
1 changed files with 6 additions and 10 deletions
|
@ -304,19 +304,15 @@ class SQLBaseStore(object):
|
||||||
" WHERE account_validity.user_id is NULL;"
|
" WHERE account_validity.user_id is NULL;"
|
||||||
)
|
)
|
||||||
txn.execute(sql, [])
|
txn.execute(sql, [])
|
||||||
return self.cursor_to_dict(txn)
|
|
||||||
|
|
||||||
res = yield self.runInteraction(
|
|
||||||
"get_users_with_no_expiration_date",
|
|
||||||
select_users_with_no_expiration_date_txn,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
res = self.cursor_to_dict(txn)
|
||||||
if res:
|
if res:
|
||||||
for user in res:
|
for user in res:
|
||||||
self.runInteraction(
|
self.set_expiration_date_for_user_txn(txn, user["name"])
|
||||||
"set_expiration_date_for_user_background",
|
|
||||||
self.set_expiration_date_for_user_txn,
|
yield self.runInteraction(
|
||||||
user["name"],
|
"get_users_with_no_expiration_date",
|
||||||
|
select_users_with_no_expiration_date_txn,
|
||||||
)
|
)
|
||||||
|
|
||||||
def set_expiration_date_for_user_txn(self, txn, user_id):
|
def set_expiration_date_for_user_txn(self, txn, user_id):
|
||||||
|
|
Loading…
Reference in a new issue