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 24, 2022
1 parent a974618 commit 720ec85
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/progressrus/store/redis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def persist(progress, now: Time.now, force: false, expires_at: nil)
if outdated?(progress) || force
key_for_scope = key(progress.scope)

redis.pipelined do
redis.hset(key_for_scope, progress.id, progress.to_serializeable.to_json)
redis.expireat(key_for_scope, expires_at.to_i) if expires_at
redis.pipelined do |pipeline|
pipeline.hset(key_for_scope, progress.id, progress.to_serializeable.to_json)
pipeline.expireat(key_for_scope, expires_at.to_i) if expires_at
end

@persisted_ats[progress.scope][progress.id] = now
Expand Down

0 comments on commit 720ec85

Please sign in to comment.