lib/metacrunch/redis/queue_reader.rb in metacrunch-3.1.1 vs lib/metacrunch/redis/queue_reader.rb in metacrunch-3.1.2

- old
+ new

@@ -1,9 +1,10 @@ require "metacrunch/redis" module Metacrunch class Redis::QueueReader + include Metacrunch::ParallelProcessableReader def initialize(redis_connection_or_url, queue_name, options = {}) @queue_name = queue_name raise ArgumentError, "queue_name must be a string" unless queue_name.is_a?(String) @@ -19,11 +20,11 @@ def each(&block) return enum_for(__method__) unless block_given? if @blocking_mode while true - result = @redis.blpop(@queue_name) - yield JSON.parse(result[1]) if result + list, result = @redis.blpop(@queue_name) + yield JSON.parse(result) if result end else while result = @redis.lpop(@queue_name) yield JSON.parse(result) end