We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1c36ca7 commit c83c1d0Copy full SHA for c83c1d0
1 file changed
models/db.js
@@ -8,7 +8,8 @@ if (process.env.spec === "true") {
8
db = settings.db.spec
9
}
10
11
-var connection = mysql.createConnection({
+var connection = mysql.createPool({
12
+ connectionLimit: 10,
13
host: db.host,
14
socketPath: db.socketPath,
15
database: db.database,
@@ -19,11 +20,7 @@ var connection = mysql.createConnection({
19
20
21
module.exports.init = function(cb) {
22
- connection.connect(err => {
23
- if (err) {
24
- return logger('[db]: error connecting: ' + err.stack);
25
- }
26
-
+ connection.on('connection', connection => {
27
logger('[db]: connected as id ' + connection.threadId);
28
cb();
29
});
0 commit comments