Improve profiling steps

This commit is contained in:
Daniel García Aubert
2018-02-28 19:27:49 +01:00
parent dad2e92dd3
commit bfb743b851
@@ -3,12 +3,15 @@ const _ = require('underscore');
module.exports = function dbConnSetup (pgConnection) {
return function dbConnSetupMiddleware(req, res, next) {
const user = res.locals.user;
pgConnection.setDBConn(user, res.locals, (err) => {
req.profiler.done('setDBConn');
if (err) {
if (err.message && -1 !== err.message.indexOf('name not found')) {
err.http_status = 404;
}
req.profiler.done('req2params');
return next(err);
}
@@ -21,8 +24,6 @@ module.exports = function dbConnSetup (pgConnection) {
res.set('X-Served-By-DB-Host', res.locals.dbhost);
req.profiler.done('req2params');
next(null);
});
};