Skip to content

Commit

Permalink
fix: specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Amnesthesia committed Nov 2, 2023
1 parent 769de31 commit 0c9b08b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/sidekiq_unique_jobs/redis/sorted_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ class SortedSet < Entity
# @return [Hash] when given with_scores: true
#
def entries(with_scores: true)
return redis { |conn| conn.zrange(key, 0, -1) } unless with_scores
entrys = redis { |conn| conn.zrange(key, 0, -1, 'withscores') }
entrys = redis do |conn|
next conn.zrange(key, 0, -1, 'withscores') if with_scores
conn.zrange(key, 0, -1)
end
return entrys unless with_scores

entrys.each_with_object({}) { |pair, hash| hash[pair[0]] = pair[1] }
end
Expand Down

0 comments on commit 0c9b08b

Please sign in to comment.