I am currently trying to improve my Redis configuration by allowing a Redis client pool to my Rails 6 app as per this thread What is the best way to use Redis in a Multi-threaded Rails environment? (Puma / Sidekiq)
Though before implementing the above I am trying to name the only Redis client my Rails app is sharing and can't manage to make this work.
redis.yml
development: url: redis://localhost:6379/ db: 0 id: my_rails_redisproduction: url: db: 0test: url: redis://localhost:6379/ db: 1
redis.rb
conf = Rails.application.config_for(:redis)redis = Redis.new(conf)
Everything works fine. My calls to Redis.current
are working properly yet in redis-cli
when I type client list
I get the following list :
id=57 addr=127.0.0.1:60754 fd=19 name= age=1099 idle=422 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=hgetid=58 addr=127.0.0.1:60756 fd=20 name=ActionCable-PID-18018 age=1099 idle=422 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=publishid=47 addr=127.0.0.1:60702 fd=8 name= age=1110 idle=1 flags=b db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=brpopid=48 addr=127.0.0.1:60704 fd=9 name= age=1110 idle=1 flags=b db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=brpopid=65 addr=127.0.0.1:32896 fd=17 name=ActionCable-PID-19465 age=460 idle=422 flags=N db=0 sub=3 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=subscribeid=49 addr=127.0.0.1:60706 fd=10 name= age=1110 idle=1 flags=b db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=brpopid=50 addr=127.0.0.1:60708 fd=11 name= age=1110 idle=5 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=scardid=63 addr=127.0.0.1:32784 fd=15 name= age=472 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=clientid=66 addr=127.0.0.1:32994 fd=18 name= age=424 idle=424 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=hgetid=67 addr=127.0.0.1:32996 fd=21 name=Sidekiq-server-PID-19455 age=424 idle=424 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=execid=64 addr=127.0.0.1:32790 fd=16 name= age=460 idle=447 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=hvalsid=62 addr=127.0.0.1:32782 fd=14 name=ActionCable-PID-19477 age=474 idle=460 flags=N db=0 sub=1 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=unsubscribeid=51 addr=127.0.0.1:60710 fd=12 name= age=1110 idle=1 flags=b db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=brpopid=52 addr=127.0.0.1:60712 fd=13 name= age=1110 idle=1 flags=b db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=brpop
with clients belonging to Actioncable or sidekiq being flagged properly though I can't see any client called my_rails_redis
.
Am I missing something ?