feat(queue): support getCountsPerPriority method [elixir] [dotnet] - #4535
feat(queue): support getCountsPerPriority method [elixir] [dotnet]#4535roggervalf wants to merge 12 commits into
Conversation
4a84c32 to
ba327aa
Compare
There was a problem hiding this comment.
Pull request overview
Adds Elixir support for getCountsPerPriority by introducing a new get_counts_per_priority/3 API and backing Redis script call, while also aligning multiple ports to the 2-key getCountsPerPriority-2.lua signature (wait + prioritized).
Changes:
- Add Elixir
Queue.get_counts_per_priority/3+ backend plumbing and tests. - Update
getCountsPerPriority-2.lua(and callers across Node/Rust/Python/PHP) to pass only the required keys. - Update Rust/Python/PHP script registries/wrappers to reference the
-2.luascript variant.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/commands/getCountsPerPriority-2.lua | Adjust Lua script key contract to (wait, prioritized). |
| src/classes/redis-queue-backend.ts | Update Node Redis backend args to pass only required keys. |
| rust/src/scripts.rs | Register getCountsPerPriority as a 2-key script using getCountsPerPriority-2.lua. |
| rust/src/queue.rs | Pass only wait + prioritized keys when invoking the script. |
| python/bullmq/scripts.py | Build script args with only wait + prioritized keys. |
| python/bullmq/redis_connection.py | Update script filename mapping to getCountsPerPriority-2.lua. |
| php/src/Scripts.php | Pass only wait + prioritized keys and exec getCountsPerPriority-2.lua. |
| elixir/test/bullmq/queue_getters_test.exs | Add coverage for get_counts_per_priority/3, including paused behavior and deduping. |
| elixir/lib/bullmq/scripts.ex | Add Redis script wrapper get_counts_per_priority/3. |
| elixir/lib/bullmq/queue.ex | Add public API get_counts_per_priority/3 and GenServer handler. |
| elixir/lib/bullmq/backends/redis.ex | Implement backend callback for Redis backend. |
| elixir/lib/bullmq/backend.ex | Add backend callback + dispatcher function for counts-per-priority. |
Suppressed comments (2)
src/commands/getCountsPerPriority-2.lua:13
- This script now treats KEYS[2] as the prioritized ZSET. Callers that still pass the legacy 4-key list (wait, paused, meta, prioritized) will end up with KEYS[2]=paused, and ZCOUNT will hit a list key (WRONGTYPE) or count the wrong structure. For example, the .NET RedisBackend still passes 4 keys. Consider making the script backward compatible by preferring KEYS[4] when present.
src/commands/getCountsPerPriority-2.lua:6 - The top-of-file comment still says "Get counts per provided states", but this script counts per priority values. Updating this header avoids misleading documentation for maintainers.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| ("paginate", 1, include_str!("commands/paginate-1.lua")), | ||
| ( | ||
| "getCountsPerPriority", | ||
| 4, | ||
| include_str!("commands/getCountsPerPriority-4.lua"), | ||
| 2, | ||
| include_str!("commands/getCountsPerPriority-2.lua"), | ||
| ), |
There was a problem hiding this comment.
on other ports, logic of script doesn't change only removing extra pause key
There was a problem hiding this comment.
yes, but was this functionality actually working on all the ports?
471d0e5 to
44bb004
Compare
| Keys.paused(ctx), | ||
| Keys.meta(ctx), | ||
| Keys.prioritized(ctx), | ||
| Keys.pc(ctx), |
There was a problem hiding this comment.
wrong keys being provided
| ] | ||
|
|
||
| args = [if(paused?, do: "paused", else: "resumed")] | ||
| args = [if(paused?, do: "paused", else: "resumed"), '1'] |
There was a problem hiding this comment.
missing to emit event
| |> maybe_add_opt("del", Map.get(job_opts, :delay) || Map.get(job_opts, "delay") || delay, 0) | ||
| |> maybe_add_opt( | ||
| "pri", | ||
| "priority", |
There was a problem hiding this comment.
we do not save short version of priority in node
703d9ef to
6c58a0e
Compare
| local waitKey = KEYS[1] | ||
| local pausedKey = KEYS[2] | ||
| local prioritizedKey = KEYS[4] | ||
| local prioritizedKey = KEYS[2] |
There was a problem hiding this comment.
This must have been broken in all ports as it is using an invalid key, are we lacking tests to cover for this functionality?
There was a problem hiding this comment.
I reviewed all ports:
- dotnet: added missing test cases and missed getCountsPerPriority method
- php: it´s covered by test cases in pause and getCountsPerPriority
- python: same as above
- rust: same as above
Co-authored-by: roggervalf <14021523+roggervalf@users.noreply.github.com>
dc3373f to
20a0ded
Compare
Port Impact Checklist
Why
Enter your explanation here.
How
Enter the implementation details here.
Additional Notes (Optional)
Any extra info here.