Add Job#save to save job info to DB

This commit is contained in:
Dzmitry Plashchynski
2015-03-06 23:41:03 +02:00
parent d0b35aaa6e
commit c54f52a71d
3 changed files with 26 additions and 2 deletions

View File

@@ -30,5 +30,14 @@ module Crono
logger.info "Finished #{performer} in %.2f seconds" % (Time.now - last_performed_at)
end
end
def save
model.update(last_performed_at: last_performed_at)
end
private
def model
@model ||= Crono::CronoJob.find_or_create_by(job_id: job_id)
end
end
end