Fix cache usage in layergroup affected tables

This commit is contained in:
Raul Ochoa 2015-07-14 20:11:49 +02:00
parent 4aabe9d946
commit 6d3ef11a7c

View File

@ -243,6 +243,7 @@ LayergroupController.prototype.sendResponse = function(req, res, args) {
self.getAffectedTables(req.context.user, dbName, req.params.token, this);
},
function sendResponse(err, affectedTables) {
req.profiler.done('affectedTables');
if (err) {
console.log('ERROR generating cache channel: ' + err);
}
@ -258,18 +259,14 @@ LayergroupController.prototype.sendResponse = function(req, res, args) {
};
LayergroupController.prototype.getAffectedTables = function(user, dbName, layergroupId, callback) {
if (this.layergroupAffectedTables.hasAffectedTables(dbName, layergroupId)) {
return callback(null, this.layergroupAffectedTables.get(dbName, layergroupId));
}
var self = this;
step(
function checkCached() {
if (self.layergroupAffectedTables.hasAffectedTables(dbName, layergroupId)) {
return callback(null, self.layergroupAffectedTables.get(dbName, layergroupId));
}
return null;
},
function extractSQL(err) {
assert.ifError(err);
function extractSQL() {
step(
function loadFromStore() {
self.mapStore.load(layergroupId, this);