Jb/muxer ruby upgrade#7
Closed
skunkworker wants to merge 15 commits into
Closed
Conversation
The MRI client is working great for both jruby and mri
film42
reviewed
Jun 3, 2026
| # Create a subscription but reset the pending queue to use a central pending queue. | ||
| # NOTE: This is a potential race condition. Chances of the round-trip message to an | ||
| # existing queue before this queue swap happens seems extremely low, but possible. | ||
| sub.pending_queue = @pending_queue |
Contributor
There was a problem hiding this comment.
I still don't love this, but I think it's probably fine. We could drop msgs here if ruby performs a long and unhealthy GC between these lines. While not probable, it's possible this happens coming out of a maintenance mode when you're not warm (jruby JITs) and requests are thrashing. But, I don't think there's a clean way to plumb, and it's not worth a thread local context hack...
# Example:
def with_pending_queue(pending_queue:)
Thread.current[:pending_queue] = @pending_queue
yield
ensure
Thread.current[:pending_queue] = nil
end
module SomethingHorrible
def initialize
super
@pending_queue = Thread.current[:pending_queue] if Thread.current[:pending_queue].present?
end
end
class NATS::IO::Subscription
prepend SomethingHorrible
end
...
with_pending_queue(pending_queue: @pending_queue)
sub = @nats.subscribe(name, queue: name)
assert sub.pending_queue == @pending_queue
endBut... that's pretty nasty 😬
skunkworker
added a commit
to skunkworker/protobuf-nats
that referenced
this pull request
Jun 24, 2026
- Bounded + jittered client retry (#1): configurable PB_NATS_CLIENT_MAX_RETRIES and PB_NATS_CLIENT_RECONNECT_DELAY_SPLAY_LIMIT; the reconnect sleep now adds random jitter so a fleet doesn't reconnect in lockstep. - ConnectionPool::TimeoutError is now retryable (mxenabled#9) -- subscription-pool exhaustion during a reconnect is transient, not an RPC_ERROR. - connection_options now forwards only nats-pure-recognized keys (mxenabled#7); app-level settings are read via their own accessors and no longer leak into connect. - YAML config uses safe_load(aliases: true) instead of unsafe_load (mxenabled#8). - Documented the client response_timeout <-> server handler_overdue coupling and the new client retry knobs in the README (mxenabled#5). Specs updated; full suite 183 examples / 0 failures. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Taking over work from #2