WIP: 282-Create InFlightNatsMsg to improve channel buffer usage. #290
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.
Here is a Draft PR based on our preliminary discussions in #282 as well as observations I've made, at least as far as how to keep this from being a breaking change or involving too much hard to maintain code (Putting a DU-esque
object
insideNatsMsg<T>
results in a -lot- of painful code, especially if fields get added in the future.)This does, however, result in a possibly (minorly) breaking change I was not initially aware of; the constructor for
NatsJSMsg<T>
was made public, and one of the optimizations that was made there was to use_context.Connection
(since that way, we can get away with not converting to a message and also makeNatsJSMsg<T>
smaller).I would not expect this to break anything internally; however if end users have tests that depend on the behavior of a
NatsJSMsg
's connection being set to something that isn't what the consumer has... it may cause them problems.We can always just not take the improvement on
NatsJSMsg
for now if this is too worrisome.I'll also note, we -can- also DU
NatsMsg<T>
as well if we wanted, however for a record struct of that style it is a bit more problematic.