Merge branch 'master' into private-cdb_tablemetadata

This commit is contained in:
Raul Ochoa 2015-02-06 18:42:18 +01:00
commit 151968ae13
2 changed files with 7 additions and 52 deletions

View File

@ -209,26 +209,11 @@ var CartodbWindshaft = function(serverOptions) {
/**
* Helper API to allow per table tile cache (and sql cache) to be invalidated remotely.
* TODO: Move?
* Keep endpoint for backwards compatibility
*/
ws.del(serverOptions.base_url + '/flush_cache', function(req, res){
if ( req.profiler && req.profiler.statsd_client ) {
req.profiler.start('windshaft-cartodb.flush_cache');
}
ws.doCORS(res);
Step(
function flushCache(){
serverOptions.flushCache(req, serverOptions.cache_enabled ? Cache : null, this);
},
function sendResponse(err, data){
if (err){
ws.sendError(res, {error: err.message}, 500, 'DELETE CACHE', err);
//ws.sendResponse(res, [500]);
} else {
ws.sendResponse(res, [{status: 'ok'}, 200]);
}
}
);
ws.sendResponse(res, [{status: 'ok'}, 200]);
});
var healthCheck = new HealthCheck(cartoData, Windshaft.tilelive);

View File

@ -1,10 +1,8 @@
var _ = require('underscore')
, Step = require('step')
, Cache = require('./cache_validator')
, QueryTablesApi = require('./api/query_tables_api')
, crypto = require('crypto')
, LZMA = require('lzma').LZMA
;
var _ = require('underscore');
var Step = require('step');
var QueryTablesApi = require('./api/query_tables_api');
var crypto = require('crypto');
var LZMA = require('lzma').LZMA;
// This is for backward compatibility with 1.3.3
if ( _.isUndefined(global.environment.sqlapi.domain) ) {
@ -824,33 +822,5 @@ module.exports = function(redisPool) {
);
};
/**
* Helper to clear out tile cache on request
* @param req
* @param callback
*/
me.flushCache = function(req, Cache, callback){
var that = this;
Step(
function getParams(){
// this is mostly to compute req.params.dbname
that.req2params(req, this);
},
function flushInternalCache(err){
// TODO: implement this, see
// http://github.com/Vizzuality/Windshaft-cartodb/issues/73
return true;
},
function flushVarnishCache(err){
if (err) { callback(err); return; }
if(Cache) {
Cache.invalidate_db(req.params.dbname, req.params.table);
}
callback(null, true);
}
);
};
return me;
};