mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Do the select and insert in a single transaction
This commit is contained in:
parent
99c4ec1eef
commit
5ceee46c6b
@ -304,21 +304,17 @@ 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(
|
res = self.cursor_to_dict(txn)
|
||||||
|
if res:
|
||||||
|
for user in res:
|
||||||
|
self.set_expiration_date_for_user_txn(txn, user["name"])
|
||||||
|
|
||||||
|
yield self.runInteraction(
|
||||||
"get_users_with_no_expiration_date",
|
"get_users_with_no_expiration_date",
|
||||||
select_users_with_no_expiration_date_txn,
|
select_users_with_no_expiration_date_txn,
|
||||||
)
|
)
|
||||||
|
|
||||||
if res:
|
|
||||||
for user in res:
|
|
||||||
self.runInteraction(
|
|
||||||
"set_expiration_date_for_user_background",
|
|
||||||
self.set_expiration_date_for_user_txn,
|
|
||||||
user["name"],
|
|
||||||
)
|
|
||||||
|
|
||||||
def set_expiration_date_for_user_txn(self, txn, user_id):
|
def set_expiration_date_for_user_txn(self, txn, user_id):
|
||||||
"""Sets an expiration date to the account with the given user ID.
|
"""Sets an expiration date to the account with the given user ID.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user