(jobs, ids)
| 355 | } |
| 356 | |
| 357 | _addJobsByIds(jobs, ids) { |
| 358 | // We need to re-ensure the queue is commandable, as we might be shutting |
| 359 | // down during this operation. |
| 360 | return this._commandable() |
| 361 | .then((client) => { |
| 362 | const got = helpers.deferred(); |
| 363 | const commandArgs = [this.toKey('jobs')].concat(ids, got.defer()); |
| 364 | client.hmget.apply(client, commandArgs); |
| 365 | return got; |
| 366 | }) |
| 367 | .then((dataArray) => { |
| 368 | const count = ids.length; |
| 369 | // Some jobs returned by the scan may have already been removed, so |
| 370 | // filter them out. |
| 371 | for (let i = 0; i < count; ++i) { |
| 372 | const jobData = dataArray[i]; |
| 373 | /* istanbul ignore else: not worth unit-testing this edge case */ |
| 374 | if (jobData) { |
| 375 | jobs.push(Job.fromData(this, ids[i], jobData)); |
| 376 | } |
| 377 | } |
| 378 | return jobs; |
| 379 | }); |
| 380 | } |
| 381 | |
| 382 | /** |
| 383 | * Get jobs from queue type. |
no test coverage detected