Cleanup, handle error in req2param on flushCache

This commit is contained in:
Sandro Santilli
2013-03-15 19:25:13 +01:00
parent 4605bd1e1d
commit 3ff3dc2c97
2 changed files with 11 additions and 5 deletions

View File

@@ -82,10 +82,10 @@ var CartodbWindshaft = function(serverOptions) {
ws.del(serverOptions.base_url + '/flush_cache', function(req, res){
ws.doCORS(res);
Step(
function(){
function flushCache(){
serverOptions.flushCache(req, serverOptions.cache_enabled ? Cache : null, this);
},
function(err, data){
function sendResponse(err, data){
if (err){
ws.sendError(res, {error: err.message}, 500, 'DELETE CACHE');
//res.send(500);

View File

@@ -354,11 +354,17 @@ module.exports = function(){
var that = this;
Step(
function(){
function getParams(){
// this is mostly to compute req.params.dbname
that.req2params(req, this);
},
function(err, data){
if (err) throw err;
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);
}