lib/rocket_job/plugins/restart.rb in rocketjob-3.4.3 vs lib/rocket_job/plugins/restart.rb in rocketjob-3.5.0
- old
+ new
@@ -21,11 +21,11 @@
# Example:
#
# class RestartableJob < RocketJob::Job
# include RocketJob::Plugins::Restart
#
- # # Retain the completed job under the completed tab in Rocket Job Mission Control.
+ # # Retain the completed job under the completed tab in Rocket Job Web Interface.
# self.destroy_on_complete = false
#
# # Will be copied to the new job on restart.
# field :limit, type: Integer, copy_on_restart: true
#
@@ -89,12 +89,12 @@
def rocket_job_restart_new_instance
if expired?
logger.info('Job has expired. Not creating a new instance.')
return
end
- attrs = rocket_job_restart_attributes.reduce({}) { |attrs, attr| attrs[attr] = send(attr); attrs }
- rocket_job_restart_create(attrs)
+ attributes = rocket_job_restart_attributes.each_with_object({}) { |attr, attrs| attrs[attr] = send(attr) }
+ rocket_job_restart_create(attributes)
end
def rocket_job_restart_abort
new_record? ? abort : abort!
end
@@ -115,9 +115,8 @@
count += 1
end
logger.warn("New job instance not started: #{job.errors.messages.inspect}")
false
end
-
end
end
end