out_rdkafka2: Fix rdkafka patch version dispatch - #578
Merged
Conversation
The elsif chain tested `>= 0.14.0` before `>= 0.16.0`, so the 0_16_0 patch has been unreachable since it was added and 0.16.0 or later kept using the 0_14_0 one. The 0.12.x arm matched 0.12.0 exactly, which left 0.12.1 through 0.13.x with no patch at all, where `producer.close(10)` raises ArgumentError on shutdown. - Order the chain from the newest version down and end it with else, so every version lands on exactly one patch - Add 0_13_0 for 0.13.x, where Rdkafka::Producer::Client became Rdkafka::NativeKafka. 0_12_0 cannot cover it: Producer has no @client there, and reopening the missing Producer::Client defines an empty class rather than raising NameError, so the rescue does not catch it - Fix the `retun` typo in 0_16_0, which is now reachable - Return whether the producer closed in time from 0_16_0, instead of the Hash that @topics_refs_map.clear returns Signed-off-by: Shizuo Fujita <fujita@clear-code.com> Co-authored-by: Claude Opus 5 <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.
>= 0.14.0was tested before>= 0.16.0, so0_16_0has never been loaded since it was added. 0.12.1 through 0.13.x matched no branch at all, whereproducer.close(10)raisesArgumentErroron shutdown. The chain now runs from the newest version down and ends withelse.0.13 is built differently from 0.12 —
Rdkafka::Producer::ClientbecameRdkafka::NativeKafka— so0_13_0is added instead of reusing0_12_0.0_16_0needed two fixes now that it is reachable: theretuntypo, andProducer#closereturning the Hash from@topics_refs_map.clearrather than whether the producer closed in time.