Closed
Description
Hi,
Lately i've been experiencing an issue where pool.getConnection(function (error, connection) is not returning a function and is hanging any Express.js request i have that contains MySQL queries.
I've done debugging and tracked it back to this code.
The code i'm using is
var mysql = require('mysql'), sApp = null;module.exports = {
connect : function (app, callback) {
sApp = app;
pool = mysql.createPool({
host : app.config.mysql.hostname,
user : app.config.mysql.username,
password : app.config.mysql.password,
database : app.config.mysql.database,
});
app.logging.info("Creating a new MySQL Pool");
callback();
},
query : function (string, params, callback) {
pool.getConnection(function (error, connection) {
console.log(error);
connection.query(string, params, function (error, rows) {
connection.end();
callback(error, rows);
});
});
}
}
Metadata
Metadata
Assignees
Labels
No labels