Move profiler start to the right place

This commit is contained in:
Daniel García Aubert 2017-11-02 10:22:30 +01:00
parent c8000e5cf8
commit eb5bf52bd9

View File

@ -113,6 +113,8 @@ MapController.prototype.register = function(app) {
};
function createGetPrepareConfig (req, res, next) {
req.profiler.start('windshaft.createmap_get');
const { config } = res.locals;
if (!config) {
@ -129,6 +131,8 @@ function createGetPrepareConfig (req, res, next) {
}
function createPostPrepareConfig(req, res, next) {
req.profiler.start('windshaft.createmap_post');
if (!req.is('application/json')) {
return next(new Error('layergroup POST data must be of type application/json'));
}
@ -137,6 +141,8 @@ function createPostPrepareConfig(req, res, next) {
}
function prepareTemplateParams(req, res, next) {
req.profiler.start('windshaft-cartodb.instance_template_post');
if (!req.is('application/json')) {
return next(new Error('Template POST data must be of type application/json'));
}
@ -145,6 +151,8 @@ function prepareTemplateParams(req, res, next) {
}
function prepareJsonTemplateParams(req, res, next) {
req.profiler.start('windshaft-cartodb.instance_template_get');
const { callback, config } = req.query;
if (callback === undefined || callback.length === 0) {
@ -163,25 +171,18 @@ function prepareJsonTemplateParams(req, res, next) {
}
MapController.prototype.createGet = function(req, res, next){
req.profiler.start('windshaft.createmap_get');
this.create(req, res, next);
};
MapController.prototype.createPost = function(req, res, next) {
req.profiler.start('windshaft.createmap_post');
this.create(req, res, next);
};
MapController.prototype.instantiate = function(req, res, next) {
req.profiler.start('windshaft-cartodb.instance_template_post');
this.instantiateTemplate(req, res, next);
};
MapController.prototype.jsonp = function(req, res, next) {
req.profiler.start('windshaft-cartodb.instance_template_get');
this.instantiateTemplate(req, res, next);
};