Skip to content

Drain in-flight concurrent ActiveJob sends on launcher shutdown#1035

Draft
mensfeld wants to merge 1 commit into
mainfrom
fix/concurrent-send-drain-on-shutdown
Draft

Drain in-flight concurrent ActiveJob sends on launcher shutdown#1035
mensfeld wants to merge 1 commit into
mainfrom
fix/concurrent-send-drain-on-shutdown

Conversation

@mensfeld

Copy link
Copy Markdown
Collaborator

The ShoryukenConcurrentSendAdapter enqueues by scheduling the SQS send on a background future and returning immediately, so jobs enqueued shortly before the process exits (e.g. by a worker during processing) could be silently dropped. PR #1018 added ShoryukenConcurrentSendAdapter#wait_for_pending_sends to drain them, but nothing called it during Shoryuken's own shutdown.

Launcher#stop and #stop! now drain the configured ActiveJob adapter after the executor has shut down (so all worker-initiated sends have been issued), bounded by Shoryuken.options[:timeout]. The call is duck-typed and guarded: it is a no-op unless ActiveJob is loaded and its adapter responds to wait_for_pending_sends, and any error is swallowed so a draining hiccup can't break shutdown.

The ShoryukenConcurrentSendAdapter enqueues by scheduling the SQS send on
a background future and returning immediately, so jobs enqueued shortly
before the process exits (e.g. by a worker during processing) could be
silently dropped. PR #1018 added ShoryukenConcurrentSendAdapter#wait_for_pending_sends
to drain them, but nothing called it during Shoryuken's own shutdown.

Launcher#stop and #stop! now drain the configured ActiveJob adapter after
the executor has shut down (so all worker-initiated sends have been
issued), bounded by Shoryuken.options[:timeout]. The call is duck-typed
and guarded: it is a no-op unless ActiveJob is loaded and its adapter
responds to wait_for_pending_sends, and any error is swallowed so a
draining hiccup can't break shutdown.
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a5e4977b-57b1-44b9-8cb3-00007a84216c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/concurrent-send-drain-on-shutdown

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.

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