Add more timing in the profile, add useProfiler config variable

Default to useProfiler:true in staging and development
This commit is contained in:
Sandro Santilli
2013-07-16 16:33:03 +02:00
parent 25c46962cb
commit ec97381820
9 changed files with 32 additions and 47 deletions
+1 -1
View File
@@ -77,4 +77,4 @@ var RedisPool = function(opts){
return me;
};
module.exports = RedisPool;
module.exports = RedisPool;
+9 -1
View File
@@ -37,7 +37,8 @@ module.exports = function(){
varnish_host: global.environment.varnish.host,
varnish_port: global.environment.varnish.port,
cache_enabled: global.environment.cache_enabled,
log_format: global.environment.log_format
log_format: global.environment.log_format,
useProfiler: global.environment.useProfiler
};
// Be nice and warn if configured mapnik version
@@ -313,6 +314,7 @@ module.exports = function(){
LZMA.decompress(
lzma,
function(result) {
if (req.profiler) req.profiler.done('LZMA decompress');
try {
delete req.query.lzma
_.extend(req.query, JSON.parse(result))
@@ -357,11 +359,14 @@ module.exports = function(){
var that = this;
if (req.profiler) req.profiler.done('req2params.setup');
Step(
function getPrivacy(){
cartoData.authorize(req, this);
},
function gatekeep(err, data){
if (req.profiler) req.profiler.done('cartoData.authorize');
if(err) throw err;
if(data === "0") throw new Error("Sorry, you are unauthorized (permission denied)");
return data;
@@ -372,18 +377,21 @@ module.exports = function(){
cartoData.getDatabase(req, this);
},
function getGeometryType(err, data){
if (req.profiler) req.profiler.done('cartoData.getDatabase');
if (err) throw err;
_.extend(req.params, {dbname:data});
cartoData.getGeometryType(req, this);
},
function finishSetup(err, data){
if (req.profiler) req.profiler.done('cartoData.getGeometryType');
if ( err ) { callback(err, req); return; }
if (!_.isNull(data))
_.extend(req.params, {geom_type: data});
that.addCacheChannel(req, function(err) {
if (req.profiler) req.profiler.done('addCacheChannel');
callback(err, req);
});
}