Add request muxer remove jnats#10
Open
skunkworker wants to merge 70 commits into
Open
Conversation
The MRI client is working great for both jruby and mri
film42
reviewed
Jun 3, 2026
elbowdonkey
reviewed
Jun 8, 2026
elbowdonkey
reviewed
Jun 8, 2026
|
|
||
| # If time has run out, we must raise a timeout error. This is the | ||
| # definitive exit condition for the loop. | ||
| raise ::NATS::Timeout if timeout && remaining <= 0 |
There was a problem hiding this comment.
We might want to do something like this in the server loop too, for similar reasons
elbowdonkey
reviewed
Jun 8, 2026
| @pending_queue << existing_pending_queue.pop | ||
| end | ||
|
|
||
| # how to close this older queue without it blocking!? |
There was a problem hiding this comment.
probably don't need this, and the following commented line, anymore
elbowdonkey
reviewed
Jun 8, 2026
| def new_request | ||
| token = ::SecureRandom.uuid # nats.new_inbox with nuid is not threadsafe. | ||
|
|
||
| @resp_sub.synchronize do |
There was a problem hiding this comment.
If start returns nil (because it can return early with nil in at least two places), @resp_sub could be nil. And if @resp_sub is nil, we'll throw a NoMethodError here. We probably don't want that.
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.
Add request muxer similar to Golang's pattern.
Removed JNats.
nats-puregem is fast enough and similar for CRuby and JRuby.Thread count does not seem to increase with the increased subscriptions.
EDIT:
June 7th
Protobuf::Nats.client_nats_connection.new_inboxis not thread safe, wrapped this in amutex.sychronizeblock.breakto benextwhen encountering unexpected messages on the client. This allows for unexpected messages to be quickly moved-on from, rather than breaking out of the outerloop doloop.loggerinstance variable for a few classes for better logging.SuperSubscriptionManangerblock, this passes in the subject now, so when the thread is full we can now report the subject of the message that pushed it over the edge. (For the future, we could allow for per-subject different thread_pools)