Use new signature for onTileErrorStrategy
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user