Restore previous beforeLayergroupCreate hook behaviour

Adds new rendercache's beforeRendererCreate hook
This commit is contained in:
Raul Ochoa 2015-04-01 19:35:55 +02:00
parent b8395010a3
commit 38e4812b43

View File

@ -242,28 +242,19 @@ module.exports = function(redisPool) {
});
};
me.beforeLayergroupCreate = function(req, requestMapConfig, callback) {
me.renderCache.beforeRendererCreate = function(req, callback) {
var user = cdbRequest.userByReq(req);
var namedLayersDatasource;
var rendererOptions = {};
step(
function extractNamedLayers() {
mapConfigNamedLayersAdapter.getLayers(user, requestMapConfig.layers, pgConnection, this);
},
function handleNamedLayers(err, layers, datasource) {
assert.ifError(err);
namedLayersDatasource = datasource;
requestMapConfig.layers = layers;
return null;
},
function getLimits(err) {
assert.ifError(err);
cartoData.getTilerRenderLimit(user, this);
},
function handleTilerLimits(err, renderLimit) {
assert.ifError(err);
req.context.limits = {
rendererOptions.limits = {
render: renderLimit
};
return null;
@ -273,7 +264,20 @@ module.exports = function(redisPool) {
return callback(err);
}
return callback(null, requestMapConfig, namedLayersDatasource);
return callback(null, rendererOptions);
}
);
};
me.beforeLayergroupCreate = function(req, requestMapConfig, callback) {
mapConfigNamedLayersAdapter.getLayers(cdbRequest.userByReq(req), requestMapConfig.layers, pgConnection,
function(err, layers, datasource) {
if (err) {
return callback(err);
}
requestMapConfig.layers = layers;
return callback(null, requestMapConfig, datasource);
}
);
};