How To Assure Unique Jobs in Sidekiq

class UniqueWorker

  def self.perform_unique_async(...<params>...)
    queue = Sidekiq::Queue.new('queue-name')
    queue.each { |q| return if q.args.join(':') == key }

    YourWorker.perform_async(...<params>...)
  end

end

Subscribe to My Newsletter

The latest programming-related news, articles and resources - sent to your inbox monthly. Unsubscribe anytime.