Class: PerformLater::Workers::ActiveRecord::LoneWorker

Inherits:
Base
  • Object
show all
Defined in:
lib/perform_later/workers/active_record/lone_worker.rb

Class Method Summary collapse

Class Method Details

.perform(klass, id, method, *args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/perform_later/workers/active_record/lone_worker.rb', line 5

def self.perform(klass, id, method, *args)
  # Remove the loner flag from redis
  digest = PerformLater::PayloadHelper.get_digest(klass, method, args)
  Resque.redis.del(digest)

  args = PerformLater::ArgsParser.args_from_resque(args)
  runner_klass = klass.constantize
  
  record = runner_klass.find(id)

  perform_job(record, method, args)
end