redis-rb
redis-rb copied to clipboard
Redis gem not able to create tcp keep alive connections on jruby
I was trying to test the tcp keep alive functionality, using the following script.
require 'redis'
option = {
:url => 'redis://localhost:6380',
:tcp_keepalive => 60
}
conn = Redis.new(option)
puts "starting psubscribe...."
conn.psubscribe('some:key') do |on|
on.pmessage do |pattern, channel, msg|
puts "Do something!"
end
end
And checked the connection information using netstat.
Initially, I ran this script on jruby 9.2.8.0. And saw the following output from netstat.

But when I run the same script on ruby 2.5.1p57 . It worked fine

Redis gem version is v3.2.1 . I even tried updating the gem to v4 but the result is same. So is there any other configuration i'm missing, that can make tcp_keepalive work for redis_client on jruby?