Skip to content

Commit

Permalink
Fix deprecated uses of Redis#pipelined
Browse files Browse the repository at this point in the history
Context: redis/redis-rb#1059

The following is deprecated
```ruby
redis.pipelined do
  redis.get(key)
end
```

And should be rewritten as:
```ruby
redis.pipelined do |pipeline|
  pipeline.get(key)
end
```

Functionally it makes no difference.
This API is available since Redis 3.0.
  • Loading branch information
byroot committed Jan 25, 2022
1 parent 0d21d87 commit 9f61bcb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion flipper-redis.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ Gem::Specification.new do |gem|
gem.metadata = Flipper::METADATA

gem.add_dependency 'flipper', "~> #{Flipper::VERSION}"
gem.add_dependency 'redis', '>= 2.2', '< 5'
gem.add_dependency 'redis', '>= 3.0', '< 5'
end
6 changes: 3 additions & 3 deletions lib/flipper/adapters/redis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ def read_feature_keys
# Private: Gets a hash of fields => values for the given feature.
#
# Returns a Hash of fields => values.
def doc_for(feature)
def doc_for(feature, _pipeline: @client)
@client.hgetall(feature.key)
end

def docs_for(features)
@client.pipelined do
@client.pipelined do |pipeline|
features.each do |feature|
doc_for(feature)
doc_for(feature, _pipeline: pipeline)
end
end
end
Expand Down

0 comments on commit 9f61bcb

Please sign in to comment.