resque/resque-unique_by_arity

Error undefined method `perform' with ActiveJob::Base

Opened this issue · 1 comments

Hi,
I have been trying to implement resque-unique_by_arity in our rails application.
As per the readme I have configured the gem after the perform class method

class MyUniqueJob < ActiveJob::Base
  queue_as :default

  def perform(args)
    # perform method here
  end

  include Resque::Plugins::UniqueByArity.new(
    arity_for_uniqueness: 1,
    unique_at_runtime: true,
    unique_in_queue: true
  )
end

I still get the error undefined method `perform' for class `#<Class:MyUniqueJob>'
Is this gem compatible with ActiveJob?
Thanks!

Hi @redseafan - that is a very good question. ActiveJob does some magic to bridge the gap between the style of Sidekiq, where perform is an instance method, and the style of Resque, where perform is a class method. I'm not sure exactly how it does that, and I've never tried using this gem with ActiveJob, but it seems like it may be possible to get it to work, and it may not be too hard. I'll leave this open so it can be looked into by me or some other enterprising individual.