contribsys / faktory_worker_ruby

Faktory worker for Ruby
GNU Lesser General Public License v3.0
214 stars 31 forks source link

Reschedule job in current queue #79

Open iamtheschmitzer opened 1 year ago

iamtheschmitzer commented 1 year ago

Inside my Faktory::Job, am attempting to reschedule the current job (same options) in the future.

  def reschedule_job(options)
    self.class.perform_in(RESCHEDULE_DELAY_DURATION, options)
  end

But this reschedules in the default queue. I would like to reschedule in the same queue if possible, but I haven't found out how to determine the current queue (my job could be enqueued in multiple queues).

Is there a way for my job to know queue that the job was dequeued from?

Thanks In advance

mperham commented 1 year ago

Jobs, by design, only have access to their arguments. You’d need to pass in the queue as an argument.