()
| 497 | } |
| 498 | |
| 499 | _waitForJob() { |
| 500 | return helpers |
| 501 | .callAsync((done) => |
| 502 | this.bclient.brpoplpush( |
| 503 | this.toKey('waiting'), |
| 504 | this.toKey('active'), |
| 505 | 0, |
| 506 | done |
| 507 | ) |
| 508 | ) |
| 509 | .then( |
| 510 | (jobId) => |
| 511 | // Note that the job may be null in the case that the client has |
| 512 | // removed the job before processing can take place, but after the |
| 513 | // brpoplpush has returned the job id. |
| 514 | Job.fromId(this, jobId), |
| 515 | (err) => { |
| 516 | if (redis.isAbortError(err) && this.paused) { |
| 517 | return null; |
| 518 | } |
| 519 | |
| 520 | this.emit('error', err); |
| 521 | |
| 522 | // Retry the brpoplpush after a delay |
| 523 | this._redisFailureRetryDelay = this._redisFailureRetryDelay |
| 524 | ? this._redisFailureRetryDelay * 2 |
| 525 | : this.settings.initialRedisFailureRetryDelay; |
| 526 | |
| 527 | return helpers |
| 528 | .delay(this._redisFailureRetryDelay) |
| 529 | .then(() => this._waitForJob()); |
| 530 | } |
| 531 | ); |
| 532 | } |
| 533 | |
| 534 | _getNextJob() { |
| 535 | this._redisFailureRetryDelay = 0; |
no test coverage detected