Skip to content

Commit

Permalink
Apply PR#468 patch only for 0.12.x.
Browse files Browse the repository at this point in the history
With #468,
 rdkafka 0.12.0 specific patch (Rdkafka::Producer::Client) was
introduced, but rdkafka's internal change was reverted
(removed Rdkafka::Producer::Client) later in 0.13.x.

So this monkey patch should be effective only between 0.12.0 and
0.12.1 (only 2 versions were shipped in 0.12.x).
For 0.13.x or later, it seems harmful.

Signed-off-by: Kentaro Hayashi <[email protected]>
  • Loading branch information
kenhys committed Jul 30, 2024
1 parent d280d38 commit 0a7c4be
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/fluent/plugin/out_rdkafka2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ class Rdkafka::Producer
def close(timeout = nil)
rdkafka_version = Rdkafka::VERSION || '0.0.0'
# Rdkafka version >= 0.12.0 changed its internals
if Gem::Version::create(rdkafka_version) >= Gem::Version.create('0.12.0')
# but reverted in >= 0.13.0
gem_version = Gem::Version::create(rdkafka_version)
if gem_version >= Gem::Version.create('0.12.0') and
gem_version <= Gem::Version.create('0.12.1')
ObjectSpace.undefine_finalizer(self)

return @client.close(timeout)
Expand Down

0 comments on commit 0a7c4be

Please sign in to comment.