nickelser / activejob-traffic_control

Rate limiting/job enabling for ActiveJob using distributed locks in Redis or Memcached.
305 stars 28 forks source link

Question: Where to put the initializer #17

Open scarroll32 opened 3 years ago

scarroll32 commented 3 years ago

In the docs it mentions we need to run:

ActiveJob::TrafficControl.client = ConnectionPool.new(size: 5, timeout: 5) { Redis.new } # set poolthresholds as needed

I assume it can just go in any initializer. I have put that in my config/initializers/active_job.rb.

Is this correct? I'm happy to submit a PR to update the docs.

thedarkside commented 1 week ago

I suppose so. Just trying to configure it for the first time now.

But this configuration would mean that the ConnectionPool is also initialized inside web processes which makes no sense, right? You just need those in the background worker processes i guess?