fix: fix race issue in prepare method (#4487)

This commit is contained in:
shiyu7 2021-07-01 06:27:12 +08:00 committed by GitHub
parent 6d64e31965
commit 16579e00c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -64,7 +64,7 @@ func (db *PreparedStmtDB) prepare(ctx context.Context, conn ConnPool, isTransact
db.Stmts[query] = Stmt{Stmt: stmt, Transaction: isTransaction} db.Stmts[query] = Stmt{Stmt: stmt, Transaction: isTransaction}
db.PreparedSQL = append(db.PreparedSQL, query) db.PreparedSQL = append(db.PreparedSQL, query)
} }
db.Mux.Unlock() defer db.Mux.Unlock()
return db.Stmts[query], err return db.Stmts[query], err
} }