diff --git a/NEWS.md b/NEWS.md index 98f2ccd6..944754a8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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. diff --git a/app/controllers/query_controller.js b/app/controllers/query_controller.js index ed3da9fd..8e09b072 100644 --- a/app/controllers/query_controller.js +++ b/app/controllers/query_controller.js @@ -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) { diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index f5ccab6e..6c461082 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -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" } } }, diff --git a/package.json b/package.json index 33bf26da..79d67b66 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/acceptance/app.test.js b/test/acceptance/app.test.js index 85a2723c..fbd74d94 100644 --- a/test/acceptance/app.test.js +++ b/test/acceptance/app.test.js @@ -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); diff --git a/test/acceptance/regressions.js b/test/acceptance/regressions.js index dd79deae..22f15b23 100644 --- a/test/acceptance/regressions.js +++ b/test/acceptance/regressions.js @@ -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 }]);