module Que::ActiveJob::WrapperExtensions::InstanceMethods
Public Instance Methods
attrs()
click to toggle source
run(args)
click to toggle source
Calls superclass method
# File lib/que/active_job/extensions.rb, line 80 def run(args) # Our ActiveJob extensions expect to be able to operate on the actual # job object, but there's no way to access it through ActiveJob. So, # scope it to the current thread. It's a bit messy, but it's the best # option under the circumstances (doesn't require hacking ActiveJob in # any more extensive way). # There's no reason this logic should ever nest, because it wouldn't # make sense to run a worker inside of a job, but even so, assert that # nothing absurd is going on. Que.assert NilClass, Thread.current[:que_current_job] begin Thread.current[:que_current_job] = self # We symbolize the args hash but ActiveJob doesn't like that :/ super(args.deep_stringify_keys) ensure # Also assert that the current job state was only removed now, but # unset the job first so that an assertion failure doesn't mess up # the state any more than it already has. current = Thread.current[:que_current_job] Thread.current[:que_current_job] = nil Que.assert(self, current) end end