impl job uid in case somebody reuses ids
This commit is contained in:
5
main.go
5
main.go
@@ -291,12 +291,13 @@ func once() error {
|
||||
jobs[i].Secrets()
|
||||
}
|
||||
logtr.Infof("once: sending jobs: %+v", jobs)
|
||||
db := config.Get().DB()
|
||||
for i := range jobs {
|
||||
if ok, err := sendJob(jobs[i]); err != nil {
|
||||
return err
|
||||
} else if ok {
|
||||
logtr.Debugf("sent job", jobs[i])
|
||||
if err := config.Get().DB().Set(jobs[i].ID, []byte(`sent`)); err != nil {
|
||||
if err := db.Set(jobs[i].UID(), []byte(`sent`)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -368,7 +369,7 @@ func updateDeadJobs(jobs []broker.Job) error {
|
||||
func dropStaleJobs(jobs []broker.Job) ([]broker.Job, error) {
|
||||
db := config.Get().DB()
|
||||
for i := len(jobs) - 1; i >= 0; i-- {
|
||||
if _, err := db.Get(jobs[i].ID); err == storage.ErrNotFound {
|
||||
if _, err := db.Get(jobs[i].UID()); err == storage.ErrNotFound {
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user