From ec0c0eb810b712262c6b11a9691c7d9f50fe0656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Thu, 4 Jul 2019 16:24:17 +0200 Subject: [PATCH] Improve readability --- lib/cartodb/api/middlewares/cache-control-header.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cartodb/api/middlewares/cache-control-header.js b/lib/cartodb/api/middlewares/cache-control-header.js index 1ef3f2df..c3bb9673 100644 --- a/lib/cartodb/api/middlewares/cache-control-header.js +++ b/lib/cartodb/api/middlewares/cache-control-header.js @@ -25,9 +25,9 @@ module.exports = function setCacheControlHeader ({ const directives = [ 'public' ]; if (everyAffectedTablesCanBeInvalidated(affectedTables)) { - directives.push(`max-age=${fallbackTtl}`); - } else { directives.push(`max-age=${ttl}`); + } else { + directives.push(`max-age=${fallbackTtl}`); } if (revalidate) { @@ -42,5 +42,5 @@ module.exports = function setCacheControlHeader ({ }; function everyAffectedTablesCanBeInvalidated (affectedTables) { - return affectedTables && affectedTables.getTables().some(table => !table.updated_at); + return affectedTables && affectedTables.getTables().every(table => !!table.updated_at); }