Log all named map invalidation with context

This commit is contained in:
Raul Ochoa 2015-04-28 17:25:07 +02:00
parent 7580081a64
commit 513fa2af01

View File

@ -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);
}
});
}