fleetmap-reports 2.0.23 → 2.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/speeding-report.js +5 -4
package/package.json
CHANGED
package/src/speeding-report.js
CHANGED
|
@@ -314,7 +314,7 @@ async function getRoadSpeedLimits (devices, routes, threshold, minimumMinutes =
|
|
|
314
314
|
|
|
315
315
|
exports.getRoadSpeedLimits = getRoadSpeedLimits
|
|
316
316
|
|
|
317
|
-
async function invokeValhalla (route, i, chunk, country, threshold, results, retry =
|
|
317
|
+
async function invokeValhalla (route, i, chunk, country, threshold, results, retry = 3) {
|
|
318
318
|
const slice = route.slice(i, i + chunk)
|
|
319
319
|
const position = slice.find(p => getCountry(p))
|
|
320
320
|
let url
|
|
@@ -348,7 +348,7 @@ async function invokeValhalla (route, i, chunk, country, threshold, results, ret
|
|
|
348
348
|
lon: p.longitude,
|
|
349
349
|
lat: p.latitude
|
|
350
350
|
}))
|
|
351
|
-
}, { timeout:
|
|
351
|
+
}, { timeout: 10000 })
|
|
352
352
|
.then(r => r.data)
|
|
353
353
|
// eslint-disable-next-line camelcase
|
|
354
354
|
matched_points.forEach((mp, mIndex) => {
|
|
@@ -360,11 +360,12 @@ async function invokeValhalla (route, i, chunk, country, threshold, results, ret
|
|
|
360
360
|
})
|
|
361
361
|
} catch (e) {
|
|
362
362
|
if (--retry) {
|
|
363
|
-
console.error(e.message, '
|
|
363
|
+
console.error('retry', retry, e.message, (e.response && e.response.data) || url, 'deviceId',
|
|
364
|
+
slice[0] && slice[0].deviceId, slice[0] && slice[0].address, slice[0] && slice[0].fixTime, country, 'chunk', chunk)
|
|
364
365
|
return invokeValhalla(route, i, chunk, country, threshold, results, retry)
|
|
365
366
|
} else {
|
|
366
367
|
console.error(e.message, (e.response && e.response.data) || url, 'deviceId',
|
|
367
|
-
slice[0] && slice[0].deviceId, slice[0] && slice[0].address, slice[0] && slice[0].fixTime, country, chunk)
|
|
368
|
+
slice[0] && slice[0].deviceId, slice[0] && slice[0].address, slice[0] && slice[0].fixTime, country, 'chunk', chunk)
|
|
368
369
|
}
|
|
369
370
|
}
|
|
370
371
|
}
|