aboutsummaryrefslogtreecommitdiff
path: root/userapi
diff options
context:
space:
mode:
authorkegsay <kegan@matrix.org>2021-07-27 12:47:50 +0100
committerGitHub <noreply@github.com>2021-07-27 12:47:50 +0100
commita060df91e206903e4e3cbf7b7d2dabddfa0bf788 (patch)
treef2ddf43418bce15f8111187209817ca23b95a8bc /userapi
parent32538640db6bfbdb890729e8137151ffbbec9a28 (diff)
Use db writer on sqlite account table (#1944)
Diffstat (limited to 'userapi')
-rw-r--r--userapi/storage/accounts/sqlite3/storage.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/userapi/storage/accounts/sqlite3/storage.go b/userapi/storage/accounts/sqlite3/storage.go
index 99e016ff..b10f25ad 100644
--- a/userapi/storage/accounts/sqlite3/storage.go
+++ b/userapi/storage/accounts/sqlite3/storage.go
@@ -160,8 +160,9 @@ func (d *Database) SetPassword(
if err != nil {
return err
}
- err = d.accounts.updatePassword(ctx, localpart, hash)
- return err
+ return d.writer.Do(nil, nil, func(txn *sql.Tx) error {
+ return d.accounts.updatePassword(ctx, localpart, hash)
+ })
}
// CreateGuestAccount makes a new guest account and creates an empty profile
@@ -388,7 +389,9 @@ func (d *Database) SearchProfiles(ctx context.Context, searchString string, limi
// DeactivateAccount deactivates the user's account, removing all ability for the user to login again.
func (d *Database) DeactivateAccount(ctx context.Context, localpart string) (err error) {
- return d.accounts.deactivateAccount(ctx, localpart)
+ return d.writer.Do(nil, nil, func(txn *sql.Tx) error {
+ return d.accounts.deactivateAccount(ctx, localpart)
+ })
}
// CreateOpenIDToken persists a new token that was issued for OpenID Connect