From 77e6fb8225d2c5f13317fad8328999d5325f5574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Wed, 13 Nov 2019 19:29:41 +0100 Subject: [PATCH 1/2] Avoid to pass undefined layergroupTTL --- lib/api/api-router.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/api/api-router.js b/lib/api/api-router.js index 142c3eba..ea38b88c 100644 --- a/lib/api/api-router.js +++ b/lib/api/api-router.js @@ -86,11 +86,15 @@ module.exports = class ApiRouter { const windshaftLogger = environmentOptions.log_windshaft && global.log4js ? global.log4js.getLogger('[windshaft]') : null; - const mapStore = new windshaft.storage.MapStore({ + + const mapStoreOptions = { pool: redisPool, - expire_time: serverOptions.grainstore.default_layergroup_ttl, logger: windshaftLogger - }); + }; + if (Number.isFinite(serverOptions.grainstore.default_layergroup_ttl)) { + mapStoreOptions.expire_time = serverOptions.grainstore.default_layergroup_ttl; + } + const mapStore = new windshaft.storage.MapStore(mapStoreOptions); const rendererFactory = createRendererFactory({ redisPool, serverOptions, environmentOptions }); From f87c43274470df765d024a048052e95d77c629b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Thu, 14 Nov 2019 13:14:31 +0100 Subject: [PATCH 2/2] Use good defaults --- lib/api/api-router.js | 9 +++------ test/acceptance/ported/support/ported-server-options.js | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/api/api-router.js b/lib/api/api-router.js index ea38b88c..b3ff84cc 100644 --- a/lib/api/api-router.js +++ b/lib/api/api-router.js @@ -87,14 +87,11 @@ module.exports = class ApiRouter { global.log4js.getLogger('[windshaft]') : null; - const mapStoreOptions = { + const mapStore = new windshaft.storage.MapStore({ pool: redisPool, + expire_time: serverOptions.grainstore.default_layergroup_ttl, logger: windshaftLogger - }; - if (Number.isFinite(serverOptions.grainstore.default_layergroup_ttl)) { - mapStoreOptions.expire_time = serverOptions.grainstore.default_layergroup_ttl; - } - const mapStore = new windshaft.storage.MapStore(mapStoreOptions); + }); const rendererFactory = createRendererFactory({ redisPool, serverOptions, environmentOptions }); diff --git a/test/acceptance/ported/support/ported-server-options.js b/test/acceptance/ported/support/ported-server-options.js index ea84a4d2..a54d08a5 100644 --- a/test/acceptance/ported/support/ported-server-options.js +++ b/test/acceptance/ported/support/ported-server-options.js @@ -16,7 +16,8 @@ module.exports = _.extend({}, serverOptions, { }, cachedir: global.environment.millstone.cache_basedir, mapnik_version: global.environment.mapnik_version || mapnik.versions.mapnik, - gc_prob: 0 // run the garbage collector at each invocation + gc_prob: 0, // run the garbage collector at each invocation + default_layergroup_ttl: global.environment.mapConfigTTL || 7200 }, renderer: { mapnik: {