Skip to content

[Bug]: removeOnComplete.age and removeOnFail.age doesn't work. #3505

@mena234

Description

@mena234

Version

5.57.0

Platform

NodeJS

What happened?

This code is supposed to remove the completed and failed tasks after 20 seconds, but this doesn't happen.

await this.renewalQueue.add(
    "process-renewal", {
        userId: subscription.user_id,
        planId: subscription.plan_id,
        planName: subscription.plan_name,
        credits: subscription.plan_credits,
    }, {
        jobId: `renewal-${subscription.user_id}`, // Deterministic ID
        priority: 1, // High priority for renewals
        removeOnComplete: {
            age: 20,
        },
        removeOnFail: {
            age: 20,
        },
    }
)

But the instant removal works fine.

{
  removeOnComplete: true,
  removeOnFail: true
}

How to reproduce.

Set a removeOnComplete.age or a removeOnFail.age for a task.

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions