From c43c56087f07c252171b85fc49a1686a49c0aeb7 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 27 Aug 2020 18:33:47 +0100 Subject: [PATCH] Review comments --- userapi/storage/devices/sqlite3/storage.go | 2 +- userapi/userapi_test.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/userapi/storage/devices/sqlite3/storage.go b/userapi/storage/devices/sqlite3/storage.go index 50b5721ec..f775fb664 100644 --- a/userapi/storage/devices/sqlite3/storage.go +++ b/userapi/storage/devices/sqlite3/storage.go @@ -181,7 +181,7 @@ func (d *Database) RemoveDevices( func (d *Database) RemoveAllDevices( ctx context.Context, localpart string, ) (devices []api.Device, err error) { - err = sqlutil.WithTransaction(d.db, func(txn *sql.Tx) error { + err = d.writer.Do(d.db, nil, func(txn *sql.Tx) error { devices, err = d.devices.selectDevicesByLocalpart(ctx, txn, localpart) if err != nil { return err diff --git a/userapi/userapi_test.go b/userapi/userapi_test.go index 4f275424c..3fc97d06a 100644 --- a/userapi/userapi_test.go +++ b/userapi/userapi_test.go @@ -31,7 +31,9 @@ func MustMakeInternalAPI(t *testing.T) (api.UserInternalAPI, accounts.Database) } cfg := &config.UserAPI{ DeviceDatabase: config.DatabaseOptions{ - ConnectionString: "file::memory:", + ConnectionString: "file::memory:", + MaxOpenConnections: 1, + MaxIdleConnections: 1, }, Matrix: &config.Global{ ServerName: serverName,