Skip to content

Add Async::Cable::Executor#8

Merged
samuel-williams-shopify merged 1 commit into
mainfrom
executor
Jun 21, 2026
Merged

Add Async::Cable::Executor#8
samuel-williams-shopify merged 1 commit into
mainfrom
executor

Conversation

@samuel-williams-shopify

Copy link
Copy Markdown
Contributor

Summary

  • Add Async::Cable::Executor, a fiber-aware replacement for Action Cable's threaded executor interface.
  • Run post and timer work on the current reactor when available, falling back to a dedicated reactor thread otherwise.
  • Add executor coverage and update the getting started guide snippet style.

Checks

  • bundle exec sus
  • bundle exec rubocop
  • bundle exec bake covered:validate

A fiber-based replacement for `ActionCable::Server::ThreadedExecutor`
that mirrors its small interface (`#post`, `#timer`, `#shutdown`)
without bouncing every call through a Concurrent::ThreadPoolExecutor.

  - `#post` is implemented as `Async { task.call }`: inside a reactor
    this spawns a fire-and-forget child task on the caller's reactor;
    outside a reactor it opens a transient reactor and runs the block
    to completion. The latter is a slow path but rare in practice.

  - `#timer` always runs on a dedicated reactor thread owned by the
    executor so the recurring task's lifetime is decoupled from any
    individual request reactor. Returns a handle that responds to
    `#shutdown`, matching the `Concurrent::TimerTask` surface that
    callers (e.g. `Channel::PeriodicTimers`) already use. The cancel
    is routed back through the executor's inbox so callers don't need
    to be inside a reactor to shut down a timer.

  - `#shutdown` stops the dedicated reactor thread (if started).

Not auto-installed: this commit only introduces the class.

Assisted-By: devx/edbcc7bd-6e27-4da8-bd2e-43c275487564
@samuel-williams-shopify samuel-williams-shopify merged commit dddef54 into main Jun 21, 2026
36 of 40 checks passed
@samuel-williams-shopify samuel-williams-shopify deleted the executor branch June 21, 2026 02:37
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