Sha256: 00be0bdf43b32aead686811a389b823a5efcdf812371e02203429ac73a2f463b
Contents?: true
Size: 1000 Bytes
Versions: 3
Compression:
Stored size: 1000 Bytes
Contents
module Lev module ActiveJob class Base < Lev.configuration.job_class def self.perform_later(routine_class, *args, &block) queue_as routine_class.active_job_queue args.push(routine_class.to_s) # Create a new status object and push its ID on to the arguments so that # in `perform` it can be used to retrieve the status when the routine is # initialized. status = Lev::create_status args.push(status.id) # In theory we'd mark as queued right after the call to super, but this messes # up when the activejob adapter runs the job right away status.queued! super(*args, &block) status.id end def perform(*args, &block) # Pop arguments added by perform_later id = args.pop routine_class = Kernel.const_get(args.pop) routine_instance = routine_class.new(Lev::find_status(id)) routine_instance.call(*args, &block) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lev-7.0.3 | lib/lev/active_job.rb |
lev-7.0.2 | lib/lev/active_job.rb |
lev-7.0.1 | lib/lev/active_job.rb |