Use new signature for onTileErrorStrategy

This commit is contained in:
Daniel García Aubert 2020-03-27 19:38:28 +01:00
parent 7a1d84a3fb
commit 4054c6923f
2 changed files with 6 additions and 8 deletions

View File

@ -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;
}
};
}

4
package-lock.json generated
View File

@ -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",