lib/rocket_job/plugins/job/worker.rb in rocketjob-5.3.2 vs lib/rocket_job/plugins/job/worker.rb in rocketjob-5.3.3
- old
+ new
@@ -71,15 +71,16 @@
rescue Exception => e
SemanticLogger.named_tagged(job: id.to_s) do
if failed? || !may_fail?
self.exception = JobException.from_exception(e)
exception.worker_name = worker_name
- save! unless new_record? || destroyed?
- elsif new_record? || destroyed?
- fail(worker_name, e)
else
- fail!(worker_name, e)
+ fail(worker_name, e)
end
+
+ # Prevent validation failures from failing the job
+ save(validate: false) unless new_record? || destroyed?
+
raise e if re_raise_exceptions
end
end
# Works on this job