edgurgel / verk

A job processing system that just verks! 🧛‍
https://hex.pm/packages/verk
MIT License
723 stars 65 forks source link

Populate finished_at when the job is success completed #121

Closed salisbury-espinosa closed 7 years ago

salisbury-espinosa commented 7 years ago

Can be useful for saving the history of completed jobs

edgurgel commented 7 years ago

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?

salisbury-espinosa commented 7 years ago

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...]
edgurgel commented 7 years ago

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

salisbury-espinosa commented 7 years ago

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

edgurgel commented 7 years ago

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 👍