class Redis::Distributed

def _bpop(cmd, args)

def _bpop(cmd, args)
  timeout = if args.last.is_a?(Hash)
    options = args.pop
    options[:timeout]
  elsif args.last.respond_to?(:to_int)
    last_arg = args.pop
    ::Redis.deprecate!(
      "Passing the timeout as a positional argument is deprecated, it should be passed as a keyword argument:\n" \
      "  redis.#{cmd}(#{args.map(&:inspect).join(', ')}, timeout: #{last_arg.to_int})" \
      "(called from: #{caller(2, 1).first})"
    )
    last_arg.to_int
  end
  keys = args.flatten
  ensure_same_node(cmd, keys) do |node|
    if timeout
      node.__send__(cmd, keys, timeout: timeout)
    else
      node.__send__(cmd, keys)
    end
  end
end