Skip to content

Fix empty batch queue routing to respect child_job_options#18

Open
bmulholland wants to merge 1 commit intoOpsLevel:masterfrom
recitalsoftware:master
Open

Fix empty batch queue routing to respect child_job_options#18
bmulholland wants to merge 1 commit intoOpsLevel:masterfrom
recitalsoftware:master

Conversation

@bmulholland
Copy link

When a Simplekiq orchestration encounters an empty batch (e.g., when guard clauses skip all child jobs in a step), Sidekiq Pro automatically schedules a Sidekiq::Batch::Empty job to ensure batch callbacks fire. However, this Empty job was being scheduled to the default queue instead of respecting the child_job_options queue configuration.

This occurred because Sidekiq Pro uses the batch.callback_queue attribute to determine the queue for Empty jobs, and Simplekiq never set this value.

This commit fixes the issue by:

  • Exposing child_job_options as a reader on Orchestration
  • Setting callback_queue on both orchestration and step batches when a queue is specified in child_job_options
  • Passing child_job_options through the callback chain so it's available in multi-step workflows

Empty jobs will now respect the configured queue, maintaining queue isolation for orchestrations that use child_job_options. Orchestrations without child_job_options continue to use the default queue as before.

When a Simplekiq orchestration encounters an empty batch (e.g., when
guard clauses skip all child jobs in a step), Sidekiq Pro automatically
schedules a Sidekiq::Batch::Empty job to ensure batch callbacks fire.
However, this Empty job was being scheduled to the default queue instead
of respecting the child_job_options queue configuration.

This occurred because Sidekiq Pro uses the batch.callback_queue attribute
to determine the queue for Empty jobs, and Simplekiq never set this value.

This commit fixes the issue by:
- Exposing child_job_options as a reader on Orchestration
- Setting callback_queue on both orchestration and step batches when a
  queue is specified in child_job_options
- Passing child_job_options through the callback chain so it's available
  in multi-step workflows

Empty jobs will now respect the configured queue, maintaining queue
isolation for orchestrations that use child_job_options. Orchestrations
without child_job_options continue to use the default queue as before.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant