From d065ace036e4dc9e28787a1e543195baddb92585 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Thu, 5 Feb 2015 17:05:50 +0100 Subject: [PATCH] Remove per table flush cache endpoint --- lib/cartodb/cartodb_windshaft.js | 19 ++------------- lib/cartodb/server_options.js | 40 ++++---------------------------- 2 files changed, 7 insertions(+), 52 deletions(-) diff --git a/lib/cartodb/cartodb_windshaft.js b/lib/cartodb/cartodb_windshaft.js index 55e59917..a5a01620 100644 --- a/lib/cartodb/cartodb_windshaft.js +++ b/lib/cartodb/cartodb_windshaft.js @@ -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); diff --git a/lib/cartodb/server_options.js b/lib/cartodb/server_options.js index a731535b..59e9fc3f 100644 --- a/lib/cartodb/server_options.js +++ b/lib/cartodb/server_options.js @@ -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; };