Add Async::Cable::Executor#8
Merged
Merged
Conversation
b2c3050 to
ba44f53
Compare
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
ba44f53 to
4c98497
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Async::Cable::Executor, a fiber-aware replacement for Action Cable's threaded executor interface.postandtimerwork on the current reactor when available, falling back to a dedicated reactor thread otherwise.Checks
bundle exec susbundle exec rubocopbundle exec bake covered:validate