One way this could be handled is promises. Since you're building a pool, you can construct your requests with something like q (or native promises, coming soon):
// assuming you have your local getConnection above or imported
exports.getConnection = function(queryParams) {
var d = q.defer();
local.getConnection(function(err, conn) {
if(err) d.reject(err);
d.resolve(conn);
});
});
So, wrap few of your other calls into promises like that and then just compose your query:
db.getConnection()
.then(function(conn){
makeRequest()
.then(...)
...
.catch(function(err){
// at the end you release the conn
});
Does it seem like something you're asking for?