From 0ad7bc5ea2960e36f4e6bc6add5681df626b632b Mon Sep 17 00:00:00 2001 From: Son Roy Almerol Date: Mon, 6 Jan 2025 09:24:06 -0500 Subject: [PATCH] fix missing job task update on function end --- internal/backend/backup/jobrun.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/backend/backup/jobrun.go b/internal/backend/backup/jobrun.go index 8f95805..dd378b4 100644 --- a/internal/backend/backup/jobrun.go +++ b/internal/backend/backup/jobrun.go @@ -333,5 +333,18 @@ func RunBackup(job *store.Job, storeInstance *store.Store, waitChan chan struct{ writer.Flush() }(job, task) + job.LastRunUpid = &task.UPID + job.LastRunState = &task.Status + + err = storeInstance.UpdateJob(*job) + if err != nil { + _ = cmd.Process.Kill() + if agentMount != nil { + agentMount.Unmount() + } + + return nil, fmt.Errorf("RunBackup: unable to update job -> %w", err) + } + return task, nil }