Do the select and insert in a single transaction

This commit is contained in:
Brendan Abolivier 2019-05-21 13:38:51 +01:00
parent 99c4ec1eef
commit 5ceee46c6b
No known key found for this signature in database
GPG Key ID: 1E015C145F1916CD

View File

@ -304,19 +304,15 @@ class SQLBaseStore(object):
" WHERE account_validity.user_id is NULL;"
)
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:
for user in res:
self.runInteraction(
"set_expiration_date_for_user_background",
self.set_expiration_date_for_user_txn,
user["name"],
self.set_expiration_date_for_user_txn(txn, user["name"])
yield self.runInteraction(
"get_users_with_no_expiration_date",
select_users_with_no_expiration_date_txn,
)
def set_expiration_date_for_user_txn(self, txn, user_id):