From 2e1f08d76495c0a914ab7038f277e6a6bfb9f534 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Mon, 6 Apr 2015 18:52:54 +0200 Subject: [PATCH] Adds a feature flag to cache timed out tile requests: cacheOnTimeout --- config/environments/development.js.example | 3 +++ config/environments/production.js.example | 3 +++ config/environments/staging.js.example | 3 +++ config/environments/test.js.example | 3 +++ lib/cartodb/server_options.js | 1 + 5 files changed, 13 insertions(+) diff --git a/config/environments/development.js.example b/config/environments/development.js.example index 398564d7..5403256d 100644 --- a/config/environments/development.js.example +++ b/config/environments/development.js.example @@ -196,6 +196,9 @@ var config = { // Use this as a feature flags enabling/disabling mechanism ,enabledFeatures: { + // whether a timed out render request should be cached in memory after is computed or not + // beware keeping it will grow up the memory usage + cacheOnTimeout: false, // whether it should intercept tile render errors an act based on them, enabled by default. onTileErrorStrategy: true, // whether the affected tables for a given SQL must query directly postgresql or use the SQL API diff --git a/config/environments/production.js.example b/config/environments/production.js.example index 7fbc6eb2..1c0ba3a7 100644 --- a/config/environments/production.js.example +++ b/config/environments/production.js.example @@ -196,6 +196,9 @@ var config = { // Use this as a feature flags enabling/disabling mechanism ,enabledFeatures: { + // whether a timed out render request should be cached in memory after is computed or not + // beware keeping it will grow up the memory usage + cacheOnTimeout: false, // whether it should intercept tile render errors an act based on them, enabled by default. onTileErrorStrategy: true, // whether the affected tables for a given SQL must query directly postgresql or use the SQL API diff --git a/config/environments/staging.js.example b/config/environments/staging.js.example index 6ad7e5d2..7375600b 100644 --- a/config/environments/staging.js.example +++ b/config/environments/staging.js.example @@ -196,6 +196,9 @@ var config = { // Use this as a feature flags enabling/disabling mechanism ,enabledFeatures: { + // whether a timed out render request should be cached in memory after is computed or not + // beware keeping it will grow up the memory usage + cacheOnTimeout: false, // whether it should intercept tile render errors an act based on them, enabled by default. onTileErrorStrategy: true, // whether the affected tables for a given SQL must query directly postgresql or use the SQL API diff --git a/config/environments/test.js.example b/config/environments/test.js.example index 99a1647a..4f0e2227 100644 --- a/config/environments/test.js.example +++ b/config/environments/test.js.example @@ -192,6 +192,9 @@ var config = { // Use this as a feature flags enabling/disabling mechanism ,enabledFeatures: { + // whether a timed out render request should be cached in memory after is computed or not + // beware keeping it will grow up the memory usage + cacheOnTimeout: false, // whether it should intercept tile render errors an act based on them, enabled by default. onTileErrorStrategy: true, // whether the affected tables for a given SQL must query directly postgresql or use the SQL API diff --git a/lib/cartodb/server_options.js b/lib/cartodb/server_options.js index ee0cb6ea..a91e03e0 100644 --- a/lib/cartodb/server_options.js +++ b/lib/cartodb/server_options.js @@ -269,6 +269,7 @@ module.exports = function(redisPool) { function handleTilerLimits(err, renderLimit) { assert.ifError(err); rendererOptions.limits = { + cacheOnTimeout: global.environment.enabledFeatures.cacheOnTimeout || false, render: renderLimit }; return null;