Skip to content
Permalink
Browse files
[misc] avoiding mysql error message if ending and sequence command ha…
…s not ended
  • Loading branch information
rusher committed Aug 25, 2018
1 parent 64ce336 commit 0221c53
Showing 1 changed file with 4 additions and 3 deletions.
@@ -36,7 +36,6 @@ try {
function Bench() {
this.dbReady = 0;
this.reportData = {};
this.ended = false;
this.driverLen = 2;

this.ready = 0;
@@ -192,12 +191,14 @@ function Bench() {
bench.initFcts[i].call(this, bench.CONN.MARIADB.drv);
}
}
this.currentNb = 0;
console.log("initializing test data done");
},

// called between running benchmarks
onCycle: function(event) {
if (!this.ended) pingAll(connList);
this.currentNb++;
if (this.currentNb < this.length) pingAll(connList);
//to avoid mysql2 taking all the server memory
if (promiseMysql2 && promiseMysql2.clearParserCache) promiseMysql2.clearParserCache();
if (mysql2 && mysql2.clearParserCache) mysql2.clearParserCache();
@@ -223,7 +224,6 @@ function Bench() {
onComplete: function() {
console.log("completed");
bench.end(bench);
this.ended = true;
}
});
}
@@ -251,6 +251,7 @@ Bench.prototype.endConnection = function(conn) {
console.log(err);
}
if (conn.pool) {
if (conn.pool.on) conn.pool.on('error', err => {});
conn.pool.end().catch(err => {
console.log("ending error for pool '" + conn.desc + "'");
console.log(err);

0 comments on commit 0221c53

Please sign in to comment.