mirror of
https://github.com/thinkjs/thinkjs.git
synced 2026-02-01 15:23:03 +00:00
release connection when query done in mysql socket
This commit is contained in:
parent
4dce495bb4
commit
f2adb80149
@ -107,6 +107,11 @@ export default class extends think.adapter.socket {
|
||||
let startTime = Date.now();
|
||||
let fn = think.promisify(connection.query, connection);
|
||||
let promise = fn(data).then((rows = []) => {
|
||||
// just call connection.release() and the connection will return to the pool,
|
||||
// ready to be used again by someone else.
|
||||
// https://github.com/felixge/node-mysql#pooling-connections
|
||||
connection.release();
|
||||
|
||||
if (this.config.log_sql) {
|
||||
think.log(sql, 'SQL', startTime);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user