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

[Bug]: OnQueueEvent for 'waiting' not triggered when job delay set to zero #3069

Closed
1 task done
ArnoPauw opened this issue Feb 10, 2025 · 2 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@ArnoPauw
Copy link

Version

v5.40.1

Platform

NodeJS

What happened?

When adding a job to a queue with delay set to 0 (zero) the OnQueueEvent 'delayed' triggers instead of 'waiting'.

One would expect a job with delay=0 is regarded as not actually being delayed.

How to reproduce.

Add job to a queue, explicitly setting the opts to { delay: 0 }

    await queue.add(name, data, {
      delay: 0,
    });

Add a OnQueueEvent event for delayed and waiting

  @OnQueueEvent('delayed')
  onDelayed({ jobId }: { jobId: string; returnvalue: string; prev?: string }) {
    this.logger.log('Delayed: ', jobId);
  }

 @OnQueueEvent('waiting')
  onWaiting({ jobId }: { jobId: string; returnvalue: string; prev?: string }) {
    this.logger.log('waiting: ', jobId);
  }

'delayed' event triggers but waiting does not trigger.

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct
@ArnoPauw ArnoPauw added the bug Something isn't working label Feb 10, 2025
@ArnoPauw
Copy link
Author

I would like to add that was introduced somewhere between v5.7.8 and v5.26, might help debugging.

@roggervalf
Copy link
Collaborator

roggervalf commented Feb 11, 2025

Hi @ArnoPauw, since v5.19.0 you will face this issue. I'm currently working on fixing it in #3052

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants