Skip to content

feat: wire push-dispatch into the Node and Java shells - #497

Merged
kartikeya-27 merged 6 commits into
ByteVeda:masterfrom
stromanni:feat/node-java-push-dispatch
Jul 22, 2026
Merged

feat: wire push-dispatch into the Node and Java shells#497
kartikeya-27 merged 6 commits into
ByteVeda:masterfrom
stromanni:feat/node-java-push-dispatch

Conversation

@stromanni

@stromanni stromanni commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Closes #480.

push-dispatch was implemented in the core but only wired by the Python binding — taskito-node and taskito-java had zero references to it.

Core

Both listener-bearing backends and SQLite were matched on by hand in the Python shell. That map now lives in one place:

  • WakeSource::for_storage(&StorageBackend) — SQLite shares the storage's Notify, Postgres/Redis spawn their listener and take its channel.
  • Scheduler::enable_push_dispatch() — the single entry point shells call. It exists in both feature states: with push-dispatch it installs the source, without it logs and keeps polling. Shells therefore carry no #[cfg] for this at all.

Node

  • push-dispatch cargo feature on taskito-node.
  • WorkerOptions.push_dispatch → TS WorkerRunOptions.pushDispatch.
  • Installed through within_runtime_if_availablestart_worker runs on the JS thread, and the Postgres/Redis listeners need a runtime context.

Java

  • push-dispatch cargo feature on taskito-java.
  • WorkerOptions.push_dispatch (wire key pushDispatch) → Worker.Builder.pushDispatch(boolean).
  • Installed under runtime.enter(), the same pattern mesh.rs already uses on the JNI thread.

Python

Collapsed onto the shared entry point: the split SQLite-outside / channel-inside install and the cfg(all(push-dispatch, any(postgres, redis))) binding gate are gone. Behavior unchanged.

Option placement

Python exposes the knob on the queue constructor. Node and Java expose it on worker options — that is where those shells configure the scheduler and where the comparable mesh opt-in lives, and a producer-only process there never starts one.

Off by default everywhere, exactly as in Python: the feature is in no shipped artifact, and the option is accepted and ignored without it.

Verification

  • cargo test --workspace --features push-dispatch green; clippy + fmt clean across default, push-dispatch, +postgres, +redis, +mesh,workflows.
  • Node 383 passed (the 9 test/dashboard/* failures are a pre-existing local build:dashboard gap, unrelated).
  • Java 376 passed; spotless + checkstyle clean.
  • Python 1277 passed, 7 skipped.
  • Confirmed the push path is live rather than merely accepted — idle dispatch latency, addon/library built both ways:
    • Node: 52ms push vs 152ms poll
    • Java: 101ms steady vs 102/202ms oscillating

CI now runs cargo test --workspace --features push-dispatch plus a push-dispatch,postgres,redis check — the feature ships in no artifact, so nothing else keeps the wiring compiling.

Summary by CodeRabbit

  • New Features

    • Added opt-in push dispatch for Java and Node.js workers.
    • Workers can now wake immediately when jobs are enqueued instead of relying on polling.
    • Added pushDispatch configuration options to worker APIs.
  • Documentation

    • Documented the new option, its default behavior, and build requirements.
  • Tests

    • Added coverage confirming prompt processing and handling of jobs queued before worker startup.

Shells matched on the storage backend themselves to build a WakeSource. Move that map into WakeSource::for_storage and expose Scheduler::enable_push_dispatch, which also exists as a logged no-op without the feature so shells need no cfg.
Adds the push-dispatch cargo feature and a pushDispatch worker option, accepted and ignored when the addon is built without the feature.
Adds the push-dispatch cargo feature and a pushDispatch(boolean) builder option, accepted and ignored when the library is built without the feature.
The feature ships in no artifact, so only CI keeps the three binding shells' wiring compiling.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8fc8a4ea-e859-48a8-b641-1836d0206cee

📥 Commits

Reviewing files that changed from the base of the PR and between 97a1f0e and b8dbdf4.

📒 Files selected for processing (17)
  • .github/workflows/ci-rust.yml
  • crates/taskito-core/src/scheduler/mod.rs
  • crates/taskito-core/src/scheduler/wake.rs
  • crates/taskito-java/Cargo.toml
  • crates/taskito-java/src/convert.rs
  • crates/taskito-java/src/worker.rs
  • crates/taskito-node/Cargo.toml
  • crates/taskito-node/src/config.rs
  • crates/taskito-node/src/worker.rs
  • crates/taskito-python/src/py_queue/worker.rs
  • docs/content/docs/java/api-reference/worker.mdx
  • docs/content/docs/node/api-reference/worker.mdx
  • sdks/java/src/main/java/org/byteveda/taskito/worker/Worker.java
  • sdks/java/src/test/java/org/byteveda/taskito/worker/PushDispatchWorkerTest.java
  • sdks/node/src/types.ts
  • sdks/node/src/worker.ts
  • sdks/node/test/worker/pushDispatch.test.ts

📝 Walkthrough

Walkthrough

Push-dispatch adds storage-specific scheduler wake sources, exposes opt-in configuration through Java and Node bindings, moves Python setup into the runtime, documents the option, adds SDK tests, and expands Rust CI feature coverage.

Changes

Push-dispatch

Layer / File(s) Summary
Backend wake-source selection
crates/taskito-core/src/scheduler/...
Schedulers now install wake sources derived from SQLite, Postgres, or Redis storage, retain polling when the feature is unavailable, and test enqueue-triggered wakeups.
Native worker integration
crates/taskito-{java,node}/..., crates/taskito-python/...
Java and Node feature flags and worker options enable push-dispatch inside runtime contexts; Python moves wake-source setup into its spawned runtime.
SDK options and behavioral coverage
sdks/java/..., sdks/node/..., docs/content/docs/{java,node}/...
Java and Node expose, forward, document, and test the pushDispatch option, including jobs queued before worker startup.
Feature-matrix validation
.github/workflows/ci-rust.yml
Rust CI tests push-dispatch across the workspace and checks its Postgres and Redis feature combinations.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested labels: python, storage

Suggested reviewers: pratyush618

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: wiring push-dispatch into the Node and Java shells.
Linked Issues check ✅ Passed The PR enables push-dispatch in both Node and Java, adds opt-in config knobs, and wires them through to scheduler wakeups as requested.
Out of Scope Changes check ✅ Passed The added docs, CI, tests, and core plumbing directly support the push-dispatch wiring and do not appear unrelated to the PR goal.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
.github/workflows/ci-rust.yml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pratyush618
pratyush618 requested a review from kartikeya-27 July 22, 2026 13:36
@kartikeya-27
kartikeya-27 merged commit 2936976 into ByteVeda:master Jul 22, 2026
58 of 60 checks passed
@pratyush618 pratyush618 mentioned this pull request Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wire push-dispatch listeners into the Node and Java shells

2 participants