Skip to content

Commit

Permalink
Fix: fix Error: Connection already released when use connectionLimi…
Browse files Browse the repository at this point in the history
…t in mysql
  • Loading branch information
welefen committed Mar 2, 2016
1 parent dbedf55 commit 63f14ca
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/adapter/socket/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,13 @@ export default class extends Base {
let str = `mysql://${config.user}:${config.password}@${config.host}:${config.port}/${config.database}`;

if (this.pool) {
return think.await(str, () => {
let fn = think.promisify(this.pool.getConnection, this.pool);
let promise = fn().catch(err => {
this.close();
return Promise.reject(err);
});
let err = new Error(str);
return think.error(promise, err);
let fn = think.promisify(this.pool.getConnection, this.pool);
let promise = fn().catch(err => {
this.close();
return Promise.reject(err);
});
let err = new Error(str);
return think.error(promise, err);
}

let mysql = await think.npm('mysql');
Expand Down

0 comments on commit 63f14ca

Please sign in to comment.