lib/qs/client.rb in qs-0.8.0 vs lib/qs/client.rb in qs-0.8.1

- old
+ new

@@ -51,32 +51,32 @@ def push(queue_name, payload_hash) raise NotImplementedError end def block_dequeue(*args) - self.redis.with{ |c| c.brpop(*args) } + self.redis.connection{ |c| c.brpop(*args) } end def append(queue_redis_key, encoded_payload) - self.redis.with{ |c| c.lpush(queue_redis_key, encoded_payload) } + self.redis.connection{ |c| c.lpush(queue_redis_key, encoded_payload) } end def prepend(queue_redis_key, encoded_payload) - self.redis.with{ |c| c.rpush(queue_redis_key, encoded_payload) } + self.redis.connection{ |c| c.rpush(queue_redis_key, encoded_payload) } end def clear(redis_key) - self.redis.with{ |c| c.del(redis_key) } + self.redis.connection{ |c| c.del(redis_key) } end def ping - self.redis.with{ |c| c.ping } + self.redis.connection{ |c| c.ping } end def sync_subscriptions(queue) pattern = Qs::Event::SubscribersRedisKey.new('*') - all_event_subs_keys = self.redis.with{ |c| c.keys(pattern) } + all_event_subs_keys = self.redis.connection{ |c| c.keys(pattern) } event_subs_keys = queue.event_route_names.map do |route_name| Qs::Event::SubscribersRedisKey.new(route_name) end redis_transaction do |c| @@ -85,19 +85,19 @@ end end def clear_subscriptions(queue) pattern = Qs::Event::SubscribersRedisKey.new('*') - event_subs_keys = self.redis.with{ |c| c.keys(pattern) } + event_subs_keys = self.redis.connection{ |c| c.keys(pattern) } redis_transaction do |c| event_subs_keys.each{ |key| c.srem(key, queue.name) } end end def event_subscribers(event) - self.redis.with{ |c| c.smembers(event.subscribers_redis_key) } + self.redis.connection{ |c| c.smembers(event.subscribers_redis_key) } end private def publish!(channel, name, options = nil) @@ -105,11 +105,11 @@ enqueue!(Qs.dispatcher_queue, dispatch_job) dispatch_job.event end def redis_transaction - self.redis.with{ |c| c.pipelined{ c.multi{ yield c } } } + self.redis.connection{ |c| c.pipelined{ c.multi{ yield c } } } end end end @@ -117,11 +117,11 @@ class QsClient include Client def initialize(*args) super - @redis = HellaRedis::Connection.new(self.redis_connect_hash) + @redis = HellaRedis.real(self.redis_connect_hash) end def push(queue_name, payload_hash) queue_redis_key = Queue::RedisKey.new(queue_name) encoded_payload = Qs.encode(payload_hash) @@ -142,11 +142,10 @@ attr_reader :pushed_items def initialize(*args) super - require 'hella-redis/connection_spy' - @redis = HellaRedis::ConnectionSpy.new(self.redis_connect_hash) + @redis = HellaRedis.mock(self.redis_connect_hash) @pushed_items = [] end def push(queue_name, payload_hash) # attempt to encode (and then throw away) the payload hash, this will