File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ const shortenPercentage = (percentage) => +percentage.toFixed(2);
2626const requestCache = new Map ( ) ;
2727const gotDefaultOptions = got . defaults . options ;
2828
29- const fetchRadar = ( dt ) =>
29+ const fetchRadar = ( dt , opts ) =>
3030 new Promise ( ( resolve , reject ) => {
3131 console . log ( `Fetch: ${ dt } ` ) ;
3232 const url = `http://www.weather.gov.sg/files/rainarea/50km/v2/dpsri_70km_${ dt } 0000dBR.dpsri.png` ;
@@ -52,6 +52,7 @@ const fetchRadar = (dt) =>
5252 } ,
5353 ] ,
5454 } ,
55+ ...opts ,
5556 } )
5657 . then ( ( response ) => {
5758 console . timeEnd ( 'Fetch radar' ) ;
@@ -219,7 +220,7 @@ module.exports = async (req, res) => {
219220 dt = + queryDt ;
220221 output = cachedOutput [ dt ] ;
221222 if ( ! output ) {
222- const img = await fetchRadar ( dt ) ;
223+ const img = await fetchRadar ( dt , { retry : 0 } ) ;
223224 const rainareas = convertImageToData ( img ) ;
224225 output = cachedOutput [ dt ] = {
225226 id : '' + dt ,
You can’t perform that action at this time.
0 commit comments