nickelser / activejob-traffic_control

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

support redis-namespace client #10

Open doits opened 5 years ago

doits commented 5 years ago

redis-namespace is a tiny wrapper around redis-rb that adds support for namespaces. It behaves exactly the same as redis-rb, so it should be supported by this gem. This PR adds support and tests for it.

To init the client you simply do:

ActiveJob::TrafficControl.client = Redis::Namespace.new(:namespace, redis: Redis.new)

Everything seems to work as it should (according to the tests).

doits commented 5 years ago

I just added a commit that does not require redis-namespace gem. So for people that have it installed, it will simply work, but people don't using it don't have to install it.

doits commented 5 years ago

I don't think the test failures relate to my changes.

doits commented 5 years ago

@nickelser do you maybe have some time to look at this? It is a fairly straight forward change the merely adds some compatibility.

doits commented 5 years ago

@nickelser maybe got some time now? or is this gem deprecated for you? If so, I could offer myself as a maintainer (got not big plans, just to keep it running).