fleetmap-reports 2.0.356 → 2.0.357

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": "2.0.356",
3
+ "version": "2.0.357",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -67,6 +67,9 @@ async function create (from, to, userData, traccar) {
67
67
  await processDevice(driversData, device, userData, { route, trips }, deviceAlarmEvents, deviceOverspeedEvents)
68
68
  deviceCount++
69
69
  }
70
+
71
+ console.log('LOADING_MESSAGE:' + slice[0].name)
72
+ console.log(`PROGRESS_PERC:${deviceCount / devices.length * 100}`)
70
73
  }
71
74
 
72
75
  const allDriversData = (Array.from(driversData.values())).filter(d => d.distance > 0)
@@ -132,7 +132,17 @@ async function getEvents (traccarInstance, from, to, devices, userData, deviceCo
132
132
  if (processServerSide() && !userData.useVehicleSpeedLimit) {
133
133
  const cookie = await axios.get('/pinmeapi/cookie/get', { withCredentials: true }).then(d => d.data)
134
134
  const url = `https://${getServerHost()}/pinmeapi/reports/speeding-report/getEvents`
135
- return axios.post(url, { from, to, devices, userData, deviceCount, totalDevices, sliceSize, cookie }, { withCredentials: true }).then(d => d.data)
135
+ const maxAttempts = 3
136
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
137
+ try {
138
+ return await axios.post(url, { from, to, devices, userData, deviceCount, totalDevices, sliceSize, cookie }, { withCredentials: true, timeout: 60000 }).then(d => d.data)
139
+ } catch (e) {
140
+ console.log(`getEvents failed for devices [${devices.map(d => d.name).join(', ')}] (attempt ${attempt}/${maxAttempts}): ${e.message}`)
141
+ if (attempt === maxAttempts) {
142
+ return []
143
+ }
144
+ }
145
+ }
136
146
  } else {
137
147
  const geofencesFeatures = userData.geofences.filter(g => g.area && g.area.startsWith('POLYGON') &&
138
148
  g.attributes.speedLimit).map(g => convertToFeature(g))