fleetmap-reports 2.0.238 → 2.0.239

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.
Files changed (2) hide show
  1. package/package.json +1 -2
  2. package/src/zone-report.js +17 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "2.0.238",
3
+ "version": "2.0.239",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -31,7 +31,6 @@
31
31
  "wkt": "^0.1.1"
32
32
  },
33
33
  "devDependencies": {
34
- "axios-debug-log": "^0.8.4",
35
34
  "eslint": "^8.15.0",
36
35
  "eslint-config-standard": "^17.0.0",
37
36
  "eslint-plugin-import": "^2.26.0",
@@ -107,7 +107,7 @@ async function createZoneReport (from, to, userData, traccar) {
107
107
 
108
108
  const url = 'https://api.pinme.io/pinmeapi/process-report/zone-report-processing'
109
109
 
110
- const limit = simpleLimit(50)
110
+ const limit = simpleLimit(25)
111
111
  const promises = sliced.map((slice, i) => limit(async () => {
112
112
  const now = new Date()
113
113
  return traccar.axios.post(url, {
@@ -118,10 +118,22 @@ async function createZoneReport (from, to, userData, traccar) {
118
118
  deviceCount: i,
119
119
  devices,
120
120
  reportRangeDays
121
- }, { timeout: 900000 }).then(response => {
122
- console.log('processed devices', slice.map(d => d.id), 'in', new Date() - now, 'ms')
123
- return response.data
124
- }).catch(e => console.error(url, e.message, e))
121
+ }, { timeout: 900000 })
122
+ .catch(e => {
123
+ console.error(url, e.message, e.response?.data || e, 'try again')
124
+ return traccar.axios.post(url, {
125
+ from,
126
+ to,
127
+ userData,
128
+ slice,
129
+ deviceCount: i,
130
+ devices,
131
+ reportRangeDays
132
+ }, { timeout: 900000 })
133
+ }).then(response => {
134
+ console.log('processed devices', slice.map(d => d.id), 'in', new Date() - now, 'ms')
135
+ return response.data
136
+ })
125
137
  })
126
138
  )
127
139
  const results = await Promise.all(promises)