fix: Fix redis-rb 4.6.0 deprecation warnings

Redis 4.6.0 deprecated calling commands on `Redis` inside `#pipelined`:

    redis.pipelined do
      redis.get("key")
    end

The above should be:

    redis.pipelined do |pipeline|
      pipeline.get("key")
    end

See: https://github.com/redis/redis-rb/pull/1059
This commit is contained in:
Alexey Zapparov 2022-02-04 21:14:00 +01:00
parent 82181325bc
commit c01208afe6
No known key found for this signature in database
GPG key ID: 1FA54F86EB189F3C

View file

@ -32,9 +32,9 @@ module Rack
def increment(key, amount, options = {})
rescuing do
pipelined do
incrby(key, amount)
expire(key, options[:expires_in]) if options[:expires_in]
pipelined do |redis|
redis.incrby(key, amount)
redis.expire(key, options[:expires_in]) if options[:expires_in]
end.first
end
end