Baton.RescheduleReporter (Baton v0.27.4)

Copy Markdown View Source

Wakes downstream steps the instant a step completes, instead of waiting for the Stager.

Baton.Worker promotes a step's now-unblocked dependents to available (via Baton.Reschedule) from inside perform/1. But promotion alone doesn't tell Oban to dispatch — the producer only learns of the available job on the Stager's next cycle (~1s). This handler closes that gap by nudging the dependents' queues.

Why a telemetry handler, and why :stop

Promotion runs while the parent is still executing (its perform/1 hasn't returned). If we nudged then, a producer with a free slot could start a dependent before the parent is committed completed, the dependent's dep check would see the parent still running, and it would snooze a full interval — worse than the Stager. So the nudge fires from [:oban, :job, :stop] with state :success, which Oban emits after it has written the parent's completed state (ack_event precedes emit_event in its executor). By then the woken dependent's dep check passes.

Attached app-wide by Baton.Application, so fast dispatch does not depend on Baton.Plugin being installed. If this handler is ever absent, promotion still happened in the worker and the Stager picks the job up in ~1s — only latency is affected, never correctness.

Summary

Functions

Attach the telemetry handler. Idempotent — a duplicate attach is a no-op.

Detach the telemetry handler.

Functions

attach()

@spec attach() :: :ok

Attach the telemetry handler. Idempotent — a duplicate attach is a no-op.

detach()

@spec detach() :: :ok

Detach the telemetry handler.