Class: Amigo::DurableJob::ClientMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/amigo/durable_job.rb

Instance Method Summary collapse

Instance Method Details

#call(worker_class, job, queue, _redis_pool) ⇒ Object



382
383
384
385
386
387
388
# File 'lib/amigo/durable_job.rb', line 382

def call(worker_class, job, queue, _redis_pool)
  return job unless Amigo::DurableJob.enabled?
  (worker_class = worker_class.constantize) if worker_class.is_a?(String)
  return job unless worker_class.respond_to?(:heartbeat_extension)
  Amigo::DurableJob.insert_job(worker_class, job.fetch("jid"), job, queue:) unless job["durable_reenqueued_at"]
  return job
end