Search code examples
rubyredisresque

Remove duplicate entries from a redis queue in resque


I am using Resque and I have a Redis queue.It has certain duplicate entries. I need to remove the duplicate entires.How do I remove those duplicate entries? I am enqueuing the id of a certain object.


Solution

  • Look into the resque-loner gem. It allows you to make job queues unique. All you do is include Resque::Plugins::UniqueJob in the job classes you you to make unique.

    class CacheSweeper
      include Resque::Plugins::UniqueJob
    
    
      class << self
        def perform(project_name)
           # some code
        end
      end
    end