From 513fa2af019a38cc9ec98bb95cd842d6d0b24a70 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Tue, 28 Apr 2015 17:25:07 +0200 Subject: [PATCH] Log all named map invalidation with context --- lib/cartodb/cartodb_windshaft.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/cartodb/cartodb_windshaft.js b/lib/cartodb/cartodb_windshaft.js index 4828fe2f..b9429a2a 100644 --- a/lib/cartodb/cartodb_windshaft.js +++ b/lib/cartodb/cartodb_windshaft.js @@ -52,9 +52,18 @@ var CartodbWindshaft = function(serverOptions) { var surrogateKeysCache = new SurrogateKeysCache(surrogateKeysCacheBackends); function invalidateNamedMap (owner, templateName) { + var startTime = Date.now(); surrogateKeysCache.invalidate(new NamedMapsCacheEntry(owner, templateName), function(err) { + var logMessage = JSON.stringify({ + username: owner, + type: 'named_map_invalidation', + elapsed: Date.now() - startTime, + error: !!err ? JSON.stringify(err.message) : undefined + }); if (err) { - console.warn('Cache: surrogate key invalidation failed'); + console.warn(logMessage); + } else { + console.info(logMessage); } }); }