Skip to content

Commit 06aa32a

Browse files
authored
Merge pull request #21 from hackmdio/fix/add-ack-after-task-is-done
fix: add ack after task is done prevent pending grow
2 parents 0be69a9 + 65361c6 commit 06aa32a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/api.js

+2
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ export class Api {
300300
if (streamlen === 0) {
301301
await this.redis.multi()
302302
.xDelIfEmpty(task.stream)
303+
.xAck(this.redisWorkerStreamName, this.redisWorkerGroupName, task.id)
303304
.xDel(this.redisWorkerStreamName, task.id)
304305
.sRem(this.workerSetName, task.stream)
305306
.exec()
@@ -318,6 +319,7 @@ export class Api {
318319
this.redis.multi()
319320
.xTrim(task.stream, 'MINID', lastId - this.redisMinMessageLifetime)
320321
.xAdd(this.redisWorkerStreamName, '*', { compact: task.stream })
322+
.xAck(this.redisWorkerStreamName, this.redisWorkerGroupName, task.id)
321323
.xDel(this.redisWorkerStreamName, task.id)
322324
.sAdd(this.workerSetName, task.stream)
323325
.exec()

0 commit comments

Comments
 (0)