You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose we have a class MyJob, inheriting from ApplicationJob:
class MyJob < ApplicationJob
include Resque::Plugins::UniqueJob
...
...
def perform(object_id)
..
end
end
By doing:
Resque.enqueue MyJob, object_id
we bypass the middle things happening inside ActiveJob framework and we call directly Resque.enqueue, which has been overriden by this gem, so the work of scheduling unique jobs is done fine.
However, when scheduling a background job through the common perform_later
To my understanding, this unfortunately makes then the is_unique? check done by this gem to be always failing because that JobWrapper class will not have the ::Resque::Plugins::UniqueJob included, thus not adhering to create unique jobs.
Hey!
Suppose we have a class MyJob, inheriting from ApplicationJob:
By doing:
we bypass the middle things happening inside ActiveJob framework and we call directly
Resque.enqueue
, which has been overriden by this gem, so the work of scheduling unique jobs is done fine.However, when scheduling a background job through the common
perform_later
then this goes through ActiveJob framework, which will be utilizing the corresponding
ResqueAdapter
, which in turn triggersResque.enqueue
but with klass set toJobWrapper
https://github.com/rails/rails/blob/main/activejob/lib/active_job/queue_adapters/resque_adapter.rb#L31-L34
To my understanding, this unfortunately makes then the
is_unique?
check done by this gem to be always failing because thatJobWrapper
class will not have the::Resque::Plugins::UniqueJob
included, thus not adhering to create unique jobs.resque_solo/lib/resque_solo/queue.rb
Lines 34 to 38 in 8f64d4a
Do I miss something obvious?
If yes, what?
If not, are there any suggestions to overcome this?
Thanks a lot in advance!
The text was updated successfully, but these errors were encountered: