lib/rocket_job/concerns/worker.rb in rocketjob-0.8.0 vs lib/rocket_job/concerns/worker.rb in rocketjob-0.9.0

- old
+ new

@@ -27,14 +27,14 @@ end # Create a job and process it immediately in-line by this thread def now(method, *args, &block) job = build(method, *args, &block) - server = Server.new(name: 'inline') - server.started + worker = RocketJob::Worker.new(name: 'inline') + worker.started job.start - while job.running? && !job.work(server) + while job.running? && !job.work(worker) end job end # Build a Rocket Job instance @@ -84,11 +84,11 @@ # # If an exception is thrown the job is marked as failed and the exception # is set in the job itself. # # Thread-safe, can be called by multiple threads at the same time - def work(server) + def work(worker) raise 'Job must be started before calling #work' unless running? begin # before_perform call_method(perform_method, arguments, event: :before, log_level: log_level) @@ -100,10 +100,10 @@ # after_perform call_method(perform_method, arguments, event: :after, log_level: log_level) complete! rescue Exception => exc - set_exception(server.name, exc) + set_exception(worker.name, exc) raise exc if RocketJob::Config.inline_mode end false end \ No newline at end of file