landed fixseen and got rid of all explicit LOCK TABLES operations (not needed in modern MySQL, especially with transaction semantics)

This commit is contained in:
2026-01-30 18:20:58 -07:00
parent f8e7816f62
commit a0d3f3715a
8 changed files with 87 additions and 76 deletions
-10
View File
@@ -694,13 +694,6 @@ func AmCreateNewUser(ctx context.Context, username string, password string, remi
tx.Rollback()
}
}()
unlock := true
tx.ExecContext(ctx, "LOCK TABLES users WRITE, userprefs WRITE, propuser WRITE, commmember WRITE, sideboxes WRITE, confhotlist WRITE;")
defer func() {
if unlock {
tx.ExecContext(ctx, "UNLOCK TABLES;")
}
}()
// Test if the user name is already taken.
row := tx.QueryRowContext(ctx, "SELECT uid FROM users WHERE username = ?", username)
@@ -749,9 +742,6 @@ func AmCreateNewUser(ctx context.Context, username string, password string, remi
return nil, err
}
tx.ExecContext(ctx, "UNLOCK TABLES;")
unlock = false
if err = tx.Commit(); err != nil {
return nil, err
}