Skip tables with no updated_at registered in cdb_tablemetadata

This commit is contained in:
Raul Ochoa 2016-07-11 16:39:12 +02:00
parent 7511178db6
commit 3ebbd9f7c4
6 changed files with 19 additions and 15 deletions

View File

@ -2,6 +2,7 @@
-------------------
New features:
* Skip tables with no updated_at registered in cdb_tablemetadata.
* Allow to setup more than one domain to validate oauth against.

View File

@ -186,9 +186,10 @@ QueryController.prototype.handleQuery = function (req, res) {
}
// Only set an X-Cache-Channel for responses we want Varnish to cache.
if (!!affectedTables && affectedTables.tables.length > 0 && !mayWrite) {
res.header('X-Cache-Channel', affectedTables.getCacheChannel());
res.header('Surrogate-Key', affectedTables.key().join(' '));
var skipNotUpdatedAtTables = true;
if (!!affectedTables && affectedTables.getTables(skipNotUpdatedAtTables).length > 0 && !mayWrite) {
res.header('X-Cache-Channel', affectedTables.getCacheChannel(skipNotUpdatedAtTables));
res.header('Surrogate-Key', affectedTables.key(skipNotUpdatedAtTables).join(' '));
}
if(!!affectedTables) {

18
npm-shrinkwrap.json generated
View File

@ -27,9 +27,9 @@
}
},
"cartodb-query-tables": {
"version": "0.1.0",
"from": "cartodb-query-tables@0.1.0",
"resolved": "https://registry.npmjs.org/cartodb-query-tables/-/cartodb-query-tables-0.1.0.tgz"
"version": "0.2.0",
"from": "cartodb-query-tables@0.2.0",
"resolved": "https://registry.npmjs.org/cartodb-query-tables/-/cartodb-query-tables-0.2.0.tgz"
},
"cartodb-redis": {
"version": "0.11.0",
@ -210,9 +210,9 @@
"resolved": "https://registry.npmjs.org/queue-async/-/queue-async-1.0.7.tgz"
},
"redis": {
"version": "2.5.3",
"version": "2.6.2",
"from": "redis@>=2.4.2 <3.0.0",
"resolved": "https://registry.npmjs.org/redis/-/redis-2.5.3.tgz",
"resolved": "https://registry.npmjs.org/redis/-/redis-2.6.2.tgz",
"dependencies": {
"double-ended-queue": {
"version": "2.1.0-0",
@ -221,13 +221,13 @@
},
"redis-commands": {
"version": "1.2.0",
"from": "redis-commands@>=1.0.1 <2.0.0",
"from": "redis-commands@>=1.2.0 <2.0.0",
"resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.2.0.tgz"
},
"redis-parser": {
"version": "1.3.0",
"from": "redis-parser@>=1.1.0 <2.0.0",
"resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-1.3.0.tgz"
"version": "2.0.3",
"from": "redis-parser@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-2.0.3.tgz"
}
}
},

View File

@ -33,7 +33,7 @@
"topojson": "0.0.8",
"underscore": "~1.6.0",
"queue-async": "~1.0.7",
"cartodb-query-tables": "0.1.0"
"cartodb-query-tables": "0.2.0"
},
"devDependencies": {
"istanbul": "~0.4.2",

View File

@ -745,7 +745,8 @@ it('TRUNCATE TABLE with GET and auth', function(done){
method: 'GET'
},{}, function(res) {
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
assert.equal(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public.test_table');
// table should not get a cache channel as it won't get invalidated
assert.ok(!res.headers.hasOwnProperty('x-cache-channel'));
assert.equal(res.headers['cache-control'], expected_cache_control);
var pbody = JSON.parse(res.body);
assert.equal(pbody.total_rows, 1);

View File

@ -45,7 +45,8 @@ describe('regressions', function() {
return done(err);
}
assert.equal(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:public."foo.bar"');
// table should not get a cache channel as it won't get invalidated
assert.ok(!res.headers.hasOwnProperty('x-cache-channel'));
var parsedBody = JSON.parse(res.body);
assert.equal(parsedBody.total_rows, 2);
assert.deepEqual(parsedBody.rows, [{ a: 1 }, { a: 2 }]);