lib/rocket_job/plugins/job/state_machine.rb in rocketjob-5.1.1 vs lib/rocket_job/plugins/job/state_machine.rb in rocketjob-5.2.0.beta1
- old
+ new
@@ -1,6 +1,6 @@
-require 'active_support/concern'
+require "active_support/concern"
module RocketJob
module Plugins
module Job
# State machine for RocketJob::Job
@@ -124,19 +124,20 @@
if exc_or_message.is_a?(Exception)
self.exception = JobException.from_exception(exc_or_message)
exception.worker_name = worker_name
else
build_exception(
- class_name: 'RocketJob::JobException',
+ class_name: "RocketJob::JobException",
message: exc_or_message,
backtrace: [],
worker_name: worker_name
)
end
end
- def rocket_job_set_started_at
- self.started_at = Time.now
+ def rocket_job_set_started_at(worker_name = nil)
+ self.started_at = Time.now
+ self.worker_name = worker_name if worker_name
end
def rocket_job_mark_complete
self.percent_complete = 100
end