2014-05-18 15:20:06 -04:00
|
|
|
require 'sucker_punch'
|
|
|
|
|
|
|
|
module ActiveJob
|
|
|
|
module QueueAdapters
|
|
|
|
class SuckerPunchAdapter
|
|
|
|
class << self
|
2014-08-25 10:34:50 -04:00
|
|
|
def enqueue(job)
|
|
|
|
JobWrapper.new.async.perform job.serialize
|
2014-05-19 06:34:27 -04:00
|
|
|
end
|
2014-05-19 18:27:28 -04:00
|
|
|
|
2014-08-25 10:34:50 -04:00
|
|
|
def enqueue_at(job, timestamp)
|
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
|
|
|
|
|
2014-09-17 15:46:53 -04:00
|
|
|
class JobWrapper #:nodoc:
|
2014-05-19 06:34:27 -04:00
|
|
|
include SuckerPunch::Job
|
|
|
|
|
2014-08-25 10:34:50 -04:00
|
|
|
def perform(job_data)
|
|
|
|
Base.execute job_data
|
2014-05-18 15:20:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|