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
Great gem, does exactly what we need, but we discovered for our application that we also need to ensure a job remains unique while also being processed. I added a small helper in our application not to enqueue jobs whose class/payload exists in any of the workers in Resque::Worker.working mainly because I wasn't quite sure where it would go in relation to this gem (if at all). Anyone have any thoughts on this? Would it make sense to include in this gem? Thanks.
The text was updated successfully, but these errors were encountered:
After reading README, my assumption was that this is the default behaviour. imo it'd be good to either add this functionality or update README to make it crystal clear that your job might be executed in parallel by different workers.
# Checks if any workers are currently working on a given job from a given queue.## @param [Symbol] queue# @param [Class] klass# @param [Array] args# @return [Boolean] whether the job is being worked on or notdefself.already_working?(queue,klass, *args)queue_workers=Resque::Worker.working.select{ |worker| worker.job['queue'] == queue.to_s}workers=queue_workers.selectdo |worker|
payload=worker.job.try(:[],'payload')ifpayload.present?payload.try(:[],'class') == klass.to_s && payload.try(:[],'args') == argselsefalseendendworkers.size > 1end
Could be refactored a bit, but it does what's needed.
Great gem, does exactly what we need, but we discovered for our application that we also need to ensure a job remains unique while also being processed. I added a small helper in our application not to enqueue jobs whose class/payload exists in any of the workers in
Resque::Worker.working
mainly because I wasn't quite sure where it would go in relation to this gem (if at all). Anyone have any thoughts on this? Would it make sense to include in this gem? Thanks.The text was updated successfully, but these errors were encountered: