fleetmap-reports 1.0.871 → 1.0.874

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.871",
3
+ "version": "1.0.874",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -309,7 +309,8 @@ async function getRoadSpeedLimits (devices, routes, threshold, minimumMinutes =
309
309
  const country = getCountry(position)
310
310
  const config = {
311
311
  CHL: getOSMSpeedingEvents,
312
- MAR: getOSMSpeedingEvents
312
+ MAR: getOSMSpeedingEvents,
313
+ BRA: getOSMSpeedingEvents
313
314
  }
314
315
  const method = config[country] || getHereEvents
315
316
  return method(devices, routes, threshold, minimumMinutes, country && country.code)
@@ -318,11 +319,13 @@ async function getRoadSpeedLimits (devices, routes, threshold, minimumMinutes =
318
319
  async function invokeValhalla (route, i, chunk, country, threshold, results, retry = 3) {
319
320
  const slice = route.slice(i, i + chunk)
320
321
  try {
322
+ const url = `http://valhalla-${getCountry(slice[0]) || country}.pinme.io:8002/trace_attributes`
323
+ console.log(url)
321
324
  const {
322
325
  // eslint-disable-next-line camelcase
323
326
  matched_points,
324
327
  edges
325
- } = await axios.post(`http://valhalla-${getCountry(slice[0]) || country}.pinme.io:8002/trace_attributes`,
328
+ } = await axios.post(url,
326
329
  {
327
330
  costing: 'auto',
328
331
  shape_match: 'map_snap',
@@ -345,7 +348,7 @@ async function invokeValhalla (route, i, chunk, country, threshold, results, ret
345
348
  lon: p.longitude,
346
349
  lat: p.latitude
347
350
  }))
348
- })
351
+ }, { timeout: 10000 })
349
352
  .then(r => r.data)
350
353
  // eslint-disable-next-line camelcase
351
354
  matched_points.forEach((mp, mIndex) => {
@@ -357,6 +360,7 @@ async function invokeValhalla (route, i, chunk, country, threshold, results, ret
357
360
  })
358
361
  } catch (e) {
359
362
  if (--retry) {
363
+ console.log(e.message, 'retry:', retry)
360
364
  return invokeValhalla(route, i, chunk, country, threshold, results, retry)
361
365
  } else {
362
366
  console.error(e.message, e.response && e.response.data, slice[0])