From 4054c6923fa658d0fd825840c25675ec570fcea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Fri, 27 Mar 2020 19:38:28 +0100 Subject: [PATCH] Use new signature for onTileErrorStrategy --- lib/api/api-router.js | 10 ++++------ package-lock.json | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/api/api-router.js b/lib/api/api-router.js index c32d8830..6459d48a 100644 --- a/lib/api/api-router.js +++ b/lib/api/api-router.js @@ -296,9 +296,9 @@ const timeoutErrorTilePath = path.join(__dirname, '/../../assets/render-timeout- const timeoutErrorTile = require('fs').readFileSync(timeoutErrorTilePath, { encoding: null }); function createRendererFactory ({ redisPool, serverOptions, environmentOptions }) { - var onTileErrorStrategy; + let onTileErrorStrategy; if (environmentOptions.enabledFeatures.onTileErrorStrategy !== false) { - onTileErrorStrategy = function onTileErrorStrategy$TimeoutTile (err, tile, headers, stats, format, callback) { + onTileErrorStrategy = async function onTileErrorStrategy$TimeoutTile (err, format) { function isRenderTimeoutError (err) { return err.message === 'Render timed out'; } @@ -316,11 +316,9 @@ function createRendererFactory ({ redisPool, serverOptions, environmentOptions } } if (isTimeoutError(err) && isRasterFormat(format)) { - return callback(null, timeoutErrorTile, { - 'Content-Type': 'image/png' - }, {}); + return { buffer: timeoutErrorTile, headers: { 'Content-Type': 'image/png' }, stats: {} }; } else { - return callback(err, tile, headers, stats); + throw err; } }; } diff --git a/package-lock.json b/package-lock.json index 02f843a7..1845b932 100644 --- a/package-lock.json +++ b/package-lock.json @@ -165,7 +165,7 @@ } }, "@carto/cartonik": { - "version": "github:cartodb/cartonik#e6f13294a8c4d03aeb68c799b711120be09afcc8", + "version": "github:cartodb/cartonik#015a6f8a16100fff5267bbd56eea5c98ffbbeed3", "from": "github:cartodb/cartonik#preview-promises", "requires": { "@carto/mapnik": "3.6.2-carto.16", @@ -6618,7 +6618,7 @@ "integrity": "sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU=" }, "windshaft": { - "version": "github:cartodb/windshaft#ad1af4efdf34ef71121ca0fe47d7c78d2b106442", + "version": "github:cartodb/windshaft#f09aca7bb72da6bce188a8190597715ca9304787", "from": "github:cartodb/windshaft#get-tile-promises", "requires": { "@carto/cartonik": "github:cartodb/cartonik#preview-promises",