Get the rendererCache's config right and avoid to set the NamedMapCacheReporter's interval to 'undefined'

This commit is contained in:
Daniel García Aubert 2020-04-04 18:51:22 +02:00
parent a8fb51ba25
commit 8bb4fbec12
3 changed files with 5 additions and 5 deletions

View File

@ -94,7 +94,7 @@ module.exports = class ApiRouter {
logger: windshaftLogger logger: windshaftLogger
}); });
const rendererStatsReporter = new RendererStatsReporter(rendererCache, serverOptions.statsInterval); const rendererStatsReporter = new RendererStatsReporter(rendererCache, serverOptions.renderCache.statsInterval);
rendererStatsReporter.start(); rendererStatsReporter.start();
const metadataBackend = cartodbRedis({ pool: redisPool }); const metadataBackend = cartodbRedis({ pool: redisPool });
@ -157,7 +157,7 @@ module.exports = class ApiRouter {
const namedMapProviderCacheReporter = new NamedMapProviderCacheReporter({ const namedMapProviderCacheReporter = new NamedMapProviderCacheReporter({
namedMapProviderCache, namedMapProviderCache,
intervalInMilliseconds: serverOptions.statsInterval intervalInMilliseconds: serverOptions.renderCache.statsInterval
}); });
namedMapProviderCacheReporter.start(); namedMapProviderCacheReporter.start();

View File

@ -102,8 +102,8 @@ module.exports = {
}, },
statsd: global.environment.statsd, statsd: global.environment.statsd,
renderCache: { renderCache: {
ttl: rendererConfig.cache_ttl, ttl: rendererConfig.cache_ttl || 60000,
statsInterval: rendererConfig.statsInterval statsInterval: rendererConfig.statsInterval || 60000
}, },
renderer: { renderer: {
mvt: Object.assign({ dbPoolParams: global.environment.postgres.pool }, rendererConfig.mvt), mvt: Object.assign({ dbPoolParams: global.environment.postgres.pool }, rendererConfig.mvt),

View File

@ -5,7 +5,7 @@ const statKeyTemplate = ctx => `windshaft.named-map-provider-cache.${ctx.metric}
module.exports = class NamedMapProviderCacheReporter { module.exports = class NamedMapProviderCacheReporter {
constructor ({ namedMapProviderCache, intervalInMilliseconds } = {}) { constructor ({ namedMapProviderCache, intervalInMilliseconds } = {}) {
this.namedMapProviderCache = namedMapProviderCache; this.namedMapProviderCache = namedMapProviderCache;
this.intervalInMilliseconds = intervalInMilliseconds; this.intervalInMilliseconds = intervalInMilliseconds || 60000;
this.intervalId = null; this.intervalId = null;
} }