We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent efbb11f commit d0acec0Copy full SHA for d0acec0
src/api.js
@@ -385,12 +385,13 @@ export class Worker {
385
}
386
387
async checkAndRecoverOrphanStreams () {
388
- const consumers = (
389
- await this.client.redis.xInfoConsumers(
390
- this.client.redisWorkerStreamName,
391
- this.client.redisWorkerGroupName
392
- )
393
- ).map(({ name }) => name)
+ const rawConsumers = await this.client.redis.xInfoConsumers(
+ this.client.redisWorkerStreamName,
+ this.client.redisWorkerGroupName
+ )
+ const consumers = rawConsumers
+ .filter((c) => c.pending > 0 || c.inactive < this.client.redisWorkerTimeout)
394
+ .map(({ name }) => name)
395
const leader = consumers.sort()[0]
396
if (this.client.consumername !== leader) return
397
0 commit comments