feat(managed-job): add restore from failed state

This commit is contained in:
2024-12-01 00:56:16 +03:30
parent 64e84c8d0f
commit dd700b6007
7 changed files with 68 additions and 16 deletions

View File

@@ -45,7 +45,7 @@ func (job *ManagedJob) cycle() {
return
}
// Check for set running or error state
if job.state.Status == JobStatusCreating {
if job.state.Status == JobStatusCreating || job.state.Status == JobStatusFailing {
err := job.checkStatus()
if errors.Is(err, ErrNoJobId) {
job.state = nil
@@ -67,5 +67,10 @@ func (job *ManagedJob) cycle() {
}
return
}
if job.state.Status == JobStatusFailed {
job.restore()
return
}
lc.Logger.Warn("[managed-job] [cycle]", zap.String("unhanded job status", string(job.state.Status)))
}