feat: expand Queue/Job/Worker API parity with Node.js BullMQ [rust] - #4219
Conversation
There was a problem hiding this comment.
Pull request overview
This PR substantially expands the Rust port’s API surface toward Node.js BullMQ parity, adding queue getters/counts/metrics, new Job methods, a new FlowProducer implementation for dependency trees, typed/TLS Redis connection options, and accompanying documentation + test coverage updates.
Changes:
- Add many Queue getter/count/metrics APIs (state-list getters, per-type counts, global concurrency/rate-limit getters, time-series metrics).
- Add Job methods for logs/dependencies and Worker behavior updates (metrics collection, discard semantics, deferred-failure handling, rate-limit retry behavior).
- Introduce FlowProducer (add/add_bulk/get_flow, per-queue defaults) and typed/TLS Redis connection options; update docs and integration tests accordingly.
Reviewed changes
Copilot reviewed 21 out of 23 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| rust/tests/queue_test.rs | Adds integration tests for new Queue getters/counts and paired getters. |
| rust/tests/metrics_test.rs | Adds integration tests for time-series metrics collection and retrieval. |
| rust/tests/job_test.rs | Adds integration tests for clear_logs and discard semantics. |
| rust/tests/connection_test.rs | Adds tests for typed connection fields and effective URL building. |
| rust/tests/common/mod.rs | Updates shared test connection helper defaults and lint allowance. |
| rust/src/worker.rs | Adds metrics packing, discard/unrecoverable handling, deferred-failure handling, rate-limit “move back to wait”, and better script error mapping for finishing. |
| rust/src/types.rs | Adds public types for metrics and dependency query results/counts. |
| rust/src/scripts.rs | Adds ScriptRegistry::load_all() to pre-load Lua scripts into Redis. |
| rust/src/redis_connection.rs | Switches connection initialization to use effective_url(). |
| rust/src/queue.rs | Implements new getters/counts/metrics/dependency helpers and extends remove behavior. |
| rust/src/options.rs | Adds typed Redis connection fields + TLS flag; adds Worker metrics options and new Job flow flags. |
| rust/src/lib.rs | Exposes FlowProducer module and re-exports additional public API types/options. |
| rust/src/job.rs | Adds discard flag plumbing, dependency APIs, waiting-children support, and log clearing. |
| rust/src/flow_producer.rs | Introduces FlowProducer for atomic flow creation and flow retrieval. |
| rust/src/error.rs | Adjusts Unrecoverable display and adds new job-state/script-related error variants. |
| rust/README.md | Updates Rust crate feature list and architecture overview; links parity doc. |
| rust/FEATURE_PARITY.md | Refreshes parity tracker and adds a detailed “Next PR” implementation plan. |
| rust/examples/benchmark.rs | Updates connection options initialization to include defaults. |
| rust/Cargo.toml | Renames published crate to bullmq-rust, keeps library name bullmq, adds TLS-enabled redis features. |
| rust/Cargo.lock | Adds a lockfile for the Rust crate. |
| docs/gitbook/rust/introduction.md | Updates installation instructions for bullmq-rust and documents typed/TLS connections. |
| docs/gitbook/rust/changelog.md | Updates Rust changelog with the new APIs/features included in this PR. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot resolve the merge conflicts in this pull request |
Resolved the merge conflicts by merging |
…orcesh/bullmq into feat/add-flow-support-rust
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot we have some vulns to be fixed: osv-scanner . |
|
@copilot continue |
Addressed in |
|
@copilot resolve the merge conflicts in this pull request |
Resolved in |
|
🎉 This PR is included in version 5.79.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 2.25.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Port Impact Checklist
Why
This PR expands Rust BullMQ API parity with Node.js BullMQ across
Queue,Job,Worker, andFlowProducer, and fixes a number of correctness and usability gaps found while iterating on the Rust port.It also includes related CI/workflow and security follow-ups needed so PR checks reflect the intended behavior during review and the repository-wide OSV scan stays green:
How
Implemented the Rust parity work across the Rust crate and supporting docs/tests, including:
QueueAPI additions for getters, ranges/counts, metrics, schedulers, dependency helpers, rate-limit helpers, and related error handlingJobAPI additions for logs, state helpers, retry/discard behavior, dependency APIs, and flow-related helpersWorkerbehavior updates for processing control flow, stalled handling, metrics, and job lifecycle parityFlowProducersupport for parent/child flows,get_flow, bulk additions, per-queue defaults, prefix validation, dedup/parent edge cases, and usable returned/reconstructedJobcontextsDebugredactionAlso updated repository workflows/configuration to match the intended PR behavior:
.github/workflows/osv-scanner.ymlnow usesfail-on-vuln: ${{ github.event_name == 'schedule' }}.github/workflows/elixir-test.ymlalways creates the expected check, while skipping Elixir steps when no Elixir files changedosv-scanner.tomlwas updated alongside the scanner workflow changeelixir/,php/, andpython/Yarn lockfiles were updated to patched dependency versions for the OSV-reported npm vulnerabilities, including the follow-upform-datafix inpython/yarn.lockmaster, the root dependency fix now follows the upstreamcoveralls-nextupgrade and no longer needs the temporary rootjs-yamlresolutionAdditional Notes (Optional)
master.