module Resque::Pertry::Persistence::ClassMethods

Public Instance Methods

after_perform_pertry_00_persistence(args = {}) click to toggle source

Resque after_perform hook (job completed successfully)

# File lib/resque/pertry/persistence.rb, line 49
def after_perform_pertry_00_persistence(args = {})
  return unless persistent?

  ResquePertryPersistence.finnish_job(self, args)
end
before_enqueue_pertry_99_persistence(args = {}) click to toggle source

Resque before_enqueue hook

# File lib/resque/pertry/persistence.rb, line 32
def before_enqueue_pertry_99_persistence(args = {})
  pertry_key = Resque::Plugins::Pertry::JOB_HASH.to_s

  args[pertry_key] ||= {}
  args[pertry_key]['audit_id'] ||= UUIDTools::UUID.random_create.to_s
  args[pertry_key]['queue_time'] ||= Time.now
  args[pertry_key]['persist'] = persistent?

  if persistent?
    ResquePertryPersistence.create_job_if_needed(self, args)
  end

  # continue with enqueue
  true
end
durable()
Alias for: persistent
non_durable()
Alias for: non_persistent
non_persistent() click to toggle source
# File lib/resque/pertry/persistence.rb, line 21
def non_persistent
  self._persistent = false
end
Also aliased as: non_durable
persistent() click to toggle source

Set job as persistent

# File lib/resque/pertry/persistence.rb, line 16
def persistent
  self._persistent = true
end
Also aliased as: durable
persistent?() click to toggle source

Check if job is persistent

# File lib/resque/pertry/persistence.rb, line 27
def persistent?
  !!self._persistent
end