bullmq icon indicating copy to clipboard operation
bullmq copied to clipboard

[Bug]: Inconsistent Use of "wait" vs "waiting" in BullMQ

Open azharuniverse opened this issue 9 months ago • 2 comments

Version

5.41.5

Platform

NodeJS

What happened?

🛠 Inconsistent Use of "wait" vs "waiting" in BullMQ

Description

BullMQ inconsistently uses "wait" in some functions and "waiting" in others, leading to confusion when working with job states.

Steps to Reproduce

  1. Call queue.getJobCounts(), and it returns { waiting: 10, active: 5, completed: 20 }.
  2. Call queue.clean(0, 100, "wait"), and it works, but queue.clean(0, 100, "waiting") does not, adding to the inconsistency.

Expected Behavior

  • The job state naming convention should be consistent across all functions.
  • Either "wait" or "waiting" should be used everywhere, not a mix of both.

Actual Behavior

  • queue.getJobCounts() uses "waiting", while queue.clean() expects "wait".
  • This inconsistency makes it difficult for developers to predict the correct parameter.

Screenshots / Logs

// Output of queue.getJobCounts()
{
  "waiting": 10,
  "active": 5,
  "completed": 20
}

// queue.clean() usage
await queue.clean(0, 100, "wait");  // ✅ Works
await queue.clean(0, 100, "waiting"); // ❌ Fails

// Expected: Either "wait" or "waiting" should be used consistently.


### How to reproduce.

_No response_

### Relevant log output

```shell

Code of Conduct

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

azharuniverse avatar Mar 06 '25 18:03 azharuniverse

thanks @azharuniverse, this is fair. But deprecating one of those parameter names would imply a breaking change. I'll take this issue in mind for next breaking change version

roggervalf avatar Mar 07 '25 01:03 roggervalf

2. Call queue.clean(0, 100, "wait"), and it works, but queue.clean(0, 100, "waiting") does not, adding to the inconsistency.

I think we could support "waiting" as well in clean, and if so it would not be a breaking change.

manast avatar Mar 09 '25 15:03 manast

:tada: This issue has been resolved in version 5.56.8 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Jul 27 '25 04:07 github-actions[bot]