edgurgel/verk

Populate finished_at when the job is success completed

salisbury-espinosa opened this issue · 5 comments

Can be useful for saving the history of completed jobs

Yeah currently we don't save the job when it's finished. We could potentially have a limited list of the last jobs completed for inspection?

Yes, in fork, I realized this for my current task.
I just decided that this is a bug, since initially it was laid in the structure, but it never changes after the job is completed

https://github.com/edgurgel/verk/blob/master/lib/verk/job.ex#L8

defmodule Verk.Job
@keys [...finished_at: nil...]

or we can simply remove the finished_at from the Job and keep it just as part of the Event?

It seems to me so it should not be done. I can save important jobs for logs in a worker and I would like to have this field filled at once, and not to pull it from Verk.Events.JobFinished. It is more convenient and logical that this information should be in the structure Verk.Job

Got it. Now I understood what you meant. So the idea is to change finished_at inside the job struct when publishing the event? Yeah it makes total sense 👍