In a recent commit, job.duration has been introduced, which computes the job's duration by substracting scheduled_at from finished_at. However, scheduled_at isn't always set because jobs can simply be enqueued with perform_later and Rails will not always set it (that's my guess from our production systems).
This prevents the show page for jobs to load for us:
Completed 500 Internal Server Error in 15ms (ActiveRecord: 3.6ms (6 queries, 0 cached) | GC: 0.0ms)
59: </td>
ActionView::Template::Error (can't convert NilClass into an exact number)
Caused by: TypeError (can't convert NilClass into an exact number)
58: <%= job.duration.round(3) %> seconds
Started GET "/jobs/applications/<redacted>/jobs/<redacted>
A possible fix would be to fetch created_at if scheduled_at hasn't been set?
https://github.com/rails/mission_control-jobs/blob/1cfb47fd3b045fdcd9d33685274ae7fddd56ec4d/lib/active_job/job_proxy.rb#L27C1-L29C6
In a recent commit,
job.durationhas been introduced, which computes the job's duration by substractingscheduled_atfromfinished_at. However,scheduled_atisn't always set because jobs can simply be enqueued withperform_laterand Rails will not always set it (that's my guess from our production systems).This prevents the
showpage for jobs to load for us:A possible fix would be to fetch
created_atifscheduled_athasn't been set?https://github.com/rails/mission_control-jobs/blob/1cfb47fd3b045fdcd9d33685274ae7fddd56ec4d/lib/active_job/job_proxy.rb#L27C1-L29C6