Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

Am I using connection pool correctly?

$
0
0

I have a rails ActiveRecord Model which is stored in MongoDB. Upon create/update/delete I have to update Redis data based on the model data. It's not a cache data we need it to be present.

Current code is something like this

Class Person
  include Mongoid::Document

  after_save do
    REDIS_POOL.with { |conn| do_something(conn, instance) }
  end
end

The problem here is when we do update multiple records in a loop I believe we would be creating unnecessary Redis connection which could have been done with a single connection.

Is there any way to avoid it?


Viewing all articles
Browse latest Browse all 873

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>