rework locker + fix job state + fix graceful stop

This commit is contained in:
rmanach
2024-09-24 11:55:33 +02:00
parent 4da553d156
commit 0cd4f264a3
2 changed files with 67 additions and 33 deletions
+4 -2
View File
@@ -59,7 +59,6 @@ type JobDetails struct {
Err string `json:"error"`
}
// TODO(rmanach): add priority level
type Job struct {
l sync.RWMutex
id uuid.UUID
@@ -130,7 +129,10 @@ func (j *Job) setFail(err error) {
now := time.Now().UTC()
j.updatedAt = &now
j.state = Failed
if j.state != Abort {
j.state = Failed
}
j.err = err
}