Skip to content

Commit

Permalink
ensuring benchmarks connection stay alive with ping between all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Jun 26, 2018
1 parent da9d047 commit 1fa092a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions benchmarks/common_benchmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ function Bench() {

// called between running benchmarks
onCycle: function(event) {
pingAll(connList);
//to avoid mysql2 taking all the server memory
if (promiseMysql2 && promiseMysql2.clearParserCache) promiseMysql2.clearParserCache();
if (mysql2 && mysql2.clearParserCache) mysql2.clearParserCache();
Expand Down Expand Up @@ -384,4 +385,12 @@ const getAddTest = function(self, suite, fct, minSamples, title, displaySql, onC
};
};

const pingAll = function(conns) {
let keys = Object.keys(conns);
for (let k = 0; k < keys.length; ++k) {
conns[keys[k]].drv.ping();
}

};

module.exports = Bench;

0 comments on commit 1fa092a

Please sign in to comment.