class Redis::Pipeline
def call(command, &block)
def call(command, &block) # A pipeline that contains a shutdown should not raise ECONNRESET when # the connection is gone. @shutdown = true if command.first == :shutdown future = Future.new(command, block) @futures << future future end
def call_pipeline(pipeline)
def call_pipeline(pipeline) @shutdown = true if pipeline.shutdown? @futures.concat(pipeline.futures) nil end
def commands
def commands @futures.map { |f| f._command } end
def finish(replies, &blk)
def finish(replies, &blk) if blk futures.each_with_index.map do |future, i| future._set(blk.call(replies[i])) end else futures.each_with_index.map do |future, i| future._set(replies[i]) end end end
def initialize
def initialize @without_reconnect = false @shutdown = false @futures = [] end
def shutdown?
def shutdown? @shutdown end
def without_reconnect(&block)
def without_reconnect(&block) @without_reconnect = true yield end
def without_reconnect?
def without_reconnect? @without_reconnect end