mobiletto 1.1.34 → 1.1.36
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/index.js +11 -11
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -504,20 +504,20 @@ async function mobiletto (driverPath, key, secret, opts, encryption = null) {
|
|
|
504
504
|
logger.error(message)
|
|
505
505
|
throw new MobilettoError(message)
|
|
506
506
|
}
|
|
507
|
-
META_LOAD_QUEUE = new Queue(META_LOAD_QUEUE_NAME, `redis://${client.redisConfig.host ||
|
|
507
|
+
META_LOAD_QUEUE = new Queue(META_LOAD_QUEUE_NAME, `redis://${client.redisConfig.host || REDIS_HOST}:${client.redisConfig.port || REDIS_PORT}`)
|
|
508
508
|
META_LOAD_QUEUE.mobilettoHandlers = {}
|
|
509
509
|
META_LOAD_QUEUE.mobilettoErrorHandlers = {}
|
|
510
510
|
META_LOAD_QUEUE.process(META_LOAD_JOB_NAME, META_LOAD_CONCURRENCY, _singleMeta)
|
|
511
511
|
META_LOAD_QUEUE.on('completed', function (job, result) {
|
|
512
512
|
logger.info(`${META_LOAD_JOB_NAME} completed with result: ${JSON.stringify(result)}`)
|
|
513
|
-
if (job.data.
|
|
514
|
-
META_LOAD_QUEUE.mobilettoHandlers[job.data.
|
|
513
|
+
if (job.data.mobilettoJobID && META_LOAD_QUEUE.mobilettoHandlers[job.data.mobilettoJobID]) {
|
|
514
|
+
META_LOAD_QUEUE.mobilettoHandlers[job.data.mobilettoJobID](result)
|
|
515
515
|
}
|
|
516
516
|
})
|
|
517
517
|
META_LOAD_QUEUE.on('failed', function (job, result) {
|
|
518
518
|
logger.info(`${META_LOAD_JOB_NAME} failed with result: ${JSON.stringify(result)}`)
|
|
519
|
-
if (job.data.
|
|
520
|
-
META_LOAD_QUEUE.mobilettoErrorHandlers[job.data.
|
|
519
|
+
if (job.data.mobilettoJobID && META_LOAD_QUEUE.mobilettoErrorHandlers[job.data.mobilettoJobID]) {
|
|
520
|
+
META_LOAD_QUEUE.mobilettoErrorHandlers[job.data.mobilettoJobID](result)
|
|
521
521
|
}
|
|
522
522
|
})
|
|
523
523
|
}
|
|
@@ -535,17 +535,17 @@ async function mobiletto (driverPath, key, secret, opts, encryption = null) {
|
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
537
|
|
|
538
|
-
const
|
|
538
|
+
const mobilettoJobID = randomstring.generate(10)
|
|
539
539
|
const mq = metaLoadQueue()
|
|
540
|
-
mq.mobilettoHandlers[
|
|
541
|
-
mq.mobilettoErrorHandlers[
|
|
540
|
+
mq.mobilettoHandlers[mobilettoJobID] = meta => files.push(meta)
|
|
541
|
+
mq.mobilettoErrorHandlers[mobilettoJobID] = err => files.push(err)
|
|
542
542
|
for (const entry of entries) {
|
|
543
|
-
const job = {
|
|
543
|
+
const job = { mobilettoJobID, dirent, entry }
|
|
544
544
|
mq.add(META_LOAD_JOB_NAME, job)
|
|
545
545
|
}
|
|
546
546
|
await new Promise(resolve => waitForFiles(resolve))
|
|
547
|
-
delete mq.mobilettoHandlers[
|
|
548
|
-
delete mq.mobilettoErrorHandlers[
|
|
547
|
+
delete mq.mobilettoHandlers[mobilettoJobID]
|
|
548
|
+
delete mq.mobilettoErrorHandlers[mobilettoJobID]
|
|
549
549
|
return files
|
|
550
550
|
}
|
|
551
551
|
|