Skip to content

Commit

Permalink
Added mysql connection pooling for reconnecting to db and better perf…
Browse files Browse the repository at this point in the history
…ormance
  • Loading branch information
zone117x committed Apr 27, 2014
1 parent 9ba337f commit 52108e3
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions libs/mposCompatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@ module.exports = function(logger, poolConfig){
var mposConfig = poolConfig.shareProcessing.mpos;
var coin = poolConfig.coin.name;

var connection;
//var connection;


var logIdentify = 'MySQL';
var logComponent = coin;

function connect(){
connection = mysql.createConnection({

connection = mysql.createPool({
host: mposConfig.host,
port: mposConfig.port,
user: mposConfig.user,
password: mposConfig.password,
database: mposConfig.database
});

/*connection = mysql.createConnection({
host: mposConfig.host,
port: mposConfig.port,
user: mposConfig.user,
Expand All @@ -33,7 +43,9 @@ module.exports = function(logger, poolConfig){
else{
logger.error(logIdentify, logComponent, 'Database error: ' + JSON.stringify(err))
}
});
});*/


}
connect();

Expand Down

0 comments on commit 52108e3

Please sign in to comment.