diff --git a/lib/sidekiq_unique_jobs/digests.rb b/lib/sidekiq_unique_jobs/digests.rb index 8186c4a3..e70ab92f 100644 --- a/lib/sidekiq_unique_jobs/digests.rb +++ b/lib/sidekiq_unique_jobs/digests.rb @@ -31,7 +31,8 @@ def add(digest) # # @param [String] pattern a key pattern to match with # @param [Integer] count the maximum number - # @return [Array] with unique digests + # @return [Hash] Hash mapping of digest matching the given pattern and score + def delete_by_pattern(pattern, count: DEFAULT_COUNT) result, elapsed = timed do digests = entries(pattern: pattern, count: count).keys @@ -80,11 +81,7 @@ def entries(pattern: SCAN_PATTERN, count: DEFAULT_COUNT) options[:match] = pattern options[:count] = count - result = redis { |conn| conn.zscan_each(key, **options).to_a } - - result.each_with_object({}) do |entry, hash| - hash[entry[0]] = entry[1] - end + redis { |conn| conn.zscan_each(key, **options).to_a }.to_h end # diff --git a/sidekiq-unique-jobs.gemspec b/sidekiq-unique-jobs.gemspec index 72bdce17..24d1f714 100644 --- a/sidekiq-unique-jobs.gemspec +++ b/sidekiq-unique-jobs.gemspec @@ -31,7 +31,7 @@ Gem::Specification.new do |spec| spec.post_install_message = <<~POST_INSTALL IMPORTANT! - Automatic configuration of the sidekiq middelware is no longer done. + Automatic configuration of the sidekiq middleware is no longer done. Please see: https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/README.md#add-the-middleware This version deprecated the following sidekiq_options