Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: TTL for job waiting in the queue #2522

Closed
royalpinto opened this issue Jan 19, 2023 · 3 comments
Closed

Feature: TTL for job waiting in the queue #2522

royalpinto opened this issue Jan 19, 2023 · 3 comments
Labels

Comments

@royalpinto
Copy link

Description

Would be nice to an option on job to set the TTL after which it will be remove from the queue if it cannot be picked by the worker by then.

A rough example would be: Job to send an OTP must be valid only for few seconds, after which should be auto cancelled/removed.

@royalpinto
Copy link
Author

taskforcesh/bullmq#301

@manast
Copy link
Member

manast commented Jan 20, 2023

You can easily accomplish this functionality by checking the timestamp in the job and just discarding it or something:

const TTL = 30_000;
const worker = new Worker('test', {...}, (job) => {
  if((Date.now() - job.timestamp) > TTL){
    return;
  }
  ...
})

@stale
Copy link

stale bot commented Apr 3, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 3, 2023
@stale stale bot closed this as completed Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants