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.
  • Loading branch information
byroot committed Jan 25, 2022
1 parent 6438588 commit e8b2e80
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/mini_profiler/storage/redis_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ def fetch_snapshots(batch_size: 200, &blk)
iteration += 1
end
if corrupt_snapshots.size > 0
redis.pipelined do
redis.zrem(zset_key, corrupt_snapshots)
redis.hdel(hash_key, corrupt_snapshots)
redis.pipelined do |pipeline|
pipeline.zrem(zset_key, corrupt_snapshots)
pipeline.hdel(hash_key, corrupt_snapshots)
end
end
end
Expand All @@ -202,9 +202,9 @@ def load_snapshot(id)
begin
Marshal.load(bytes)
rescue
redis.pipelined do
redis.zrem(snapshot_zset_key(), id)
redis.hdel(hash_key, id)
redis.pipelined do |pipeline|
pipeline.zrem(snapshot_zset_key(), id)
pipeline.hdel(hash_key, id)
end
nil
end
Expand Down Expand Up @@ -253,11 +253,11 @@ def cached_redis_eval(script, script_sha, reraise: true, argv: [], keys: [])

# only used in tests
def wipe_snapshots_data
redis.pipelined do
redis.del(snapshot_counter_key())
redis.del(snapshot_zset_key())
redis.del(snapshot_hash_key())
end
redis.del(
snapshot_counter_key(),
snapshot_zset_key(),
snapshot_hash_key(),
)
end
end
end
Expand Down

0 comments on commit e8b2e80

Please sign in to comment.