Commit a0089a56 authored by Rosanny Sihombing's avatar Rosanny Sihombing
Browse files

Merge branch 'MLAB-609' into 'testing'

using connection pool

See merge request !81
parents d2a5ff3d 192d4184
Pipeline #5272 passed with stage
in 25 seconds
......@@ -4,35 +4,34 @@ var env = process.env.NODE_ENV || 'testing';
const config = require('./config')[env]
// ==== USER ACOOUNT DB CONNECTION ====
var userConnection = mysql.createConnection({
const userConnection = mysql.createPool({
host: config.database.host,
user: config.database.user,
password: config.database.password,
port: config.database.port,
database: config.database.dbUser,
multipleStatements: true
waitForConnections: true,
connectionLimit: 10,
queueLimit: 0
})
userConnection.connect(function(err) {
if (err) throw err;
})
userConnection.query('USE '+config.database.dbUser)
// ==== PROJECT DB CONNECTION ====
var projectConnection = mysql.createConnection({
const projectConnection = mysql.createPool({
host: config.database.host_project,
user: config.database.user,
password: config.database.password,
port: config.database.port,
database: config.database.dbProject
database: config.database.dbProject,
waitForConnections: true,
connectionLimit: 10,
queueLimit: 0
})
projectConnection.connect(function(err) {
if (err) throw err;
})
projectConnection.query('USE '+config.database.dbProject)
var connection = {
const connection = {
user: userConnection,
project: projectConnection
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment