2014-05-18 15:20:06 -04:00
|
|
|
require 'sucker_punch'
|
|
|
|
|
|
|
|
module ActiveJob
|
|
|
|
module QueueAdapters
|
|
|
|
class SuckerPunchAdapter
|
|
|
|
class << self
|
2014-05-20 19:07:45 -04:00
|
|
|
def enqueue(job, *args)
|
2014-05-20 13:17:25 -04:00
|
|
|
JobWrapper.new.async.perform job, *args
|
2014-05-19 06:34:27 -04:00
|
|
|
end
|
2014-05-19 18:27:28 -04:00
|
|
|
|
2014-05-20 19:07:45 -04:00
|
|
|
def enqueue_at(job, timestamp, *args)
|
2014-05-20 12:52:20 -04:00
|
|
|
raise NotImplementedError
|
2014-05-19 18:27:28 -04:00
|
|
|
end
|
2014-05-19 06:34:27 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
class JobWrapper
|
|
|
|
include SuckerPunch::Job
|
|
|
|
|
2014-05-20 04:26:04 -04:00
|
|
|
def perform(job, *args)
|
2014-08-18 09:09:04 -04:00
|
|
|
job.new.execute(*args)
|
2014-05-18 15:20:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|