app/models/concerns/good_job/reportable.rb in good_job-4.1.0 vs app/models/concerns/good_job/reportable.rb in good_job-4.1.1
- old
+ new
@@ -14,30 +14,26 @@
# - discarded: The job previously errored on execution and will not be re-executed in the future.
#
# @return [Symbol]
def status
if finished_at.present?
- if error.present? && retried_good_job_id.present?
- :retried
- elsif error.present? && retried_good_job_id.nil?
+ if error.present?
:discarded
else
:succeeded
end
- elsif (scheduled_at || created_at) > DateTime.current
- if serialized_params.fetch('executions', 0) > 1
- :retried
- else
- :scheduled
- end
- elsif running?
+ elsif performed_at.present?
:running
- else
+ elsif (scheduled_at || created_at) <= DateTime.current
:queued
+ elsif error.present?
+ :retried
+ else
+ :scheduled
end
end
- # The last relevant timestamp for this execution
+ # The last relevant timestamp for this job
def last_status_at
finished_at || performed_at || scheduled_at || created_at
end
end
end