fleetmap-reports 1.0.748 → 1.0.749

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.748",
3
+ "version": "1.0.749",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -227,7 +227,9 @@ async function processDrivers (from, to, userData, data) {
227
227
  if (isClientSide()) {
228
228
  idleEvents.push(...(calculateIdleEvents(userData.drivers, data.route)))
229
229
  } else {
230
- idleEvents.push(...(await parallel('trip-report', 'calculateIdleEvents', userData.drivers, data.route)))
230
+ if (data.route.length) {
231
+ idleEvents.push(...(await parallel('trip-report', 'calculateIdleEvents', userData.drivers, data.route)))
232
+ }
231
233
  }
232
234
 
233
235
  userData.drivers.forEach(d => {
@@ -18,7 +18,7 @@ exports.parallel = (report, method, toSlice, ...args) => {
18
18
  }
19
19
  sliced.forEach((slice) => {
20
20
  try {
21
- console.log('forking worker', workerCount++, report, method, slice)
21
+ console.log('forking worker', workerCount++, report, method, slice, ...args)
22
22
  const worker = cluster.fork()
23
23
  worker.send({
24
24
  report,
@@ -2,6 +2,7 @@ const path = require('path')
2
2
  console.log(`worker ${process.pid} is running`, process.cwd())
3
3
  process.on('message', async (message) => {
4
4
  const { report, method, args } = message
5
+ console.log(`worker ${process.pid} is running`, process.cwd(), report, method, args)
5
6
  const _report = require(path.resolve(__dirname, `../${report}`))
6
7
  process.send({ result: await _report[method](...args) })
7
8
  })