mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-27 04:35:16 +01:00
Fix nil job returned bug
This commit is contained in:
parent
49bb9bfceb
commit
e160804be2
@ -256,6 +256,11 @@ func (gcwp *GoCraftWorkPool) Enqueue(jobName string, params models.Parameters, i
|
||||
return models.JobStats{}, err
|
||||
}
|
||||
|
||||
//avoid backend pool bug
|
||||
if j == nil {
|
||||
return models.JobStats{}, fmt.Errorf("job '%s' can not be enqueued, please check the job metatdata", jobName)
|
||||
}
|
||||
|
||||
res := generateResult(j, job.JobKindGeneric, isUnique)
|
||||
//Save data with async way. Once it fails to do, let it escape
|
||||
//The client method may help if the job is still in progress when get stats of this job
|
||||
@ -282,6 +287,11 @@ func (gcwp *GoCraftWorkPool) Schedule(jobName string, params models.Parameters,
|
||||
return models.JobStats{}, err
|
||||
}
|
||||
|
||||
//avoid backend pool bug
|
||||
if j == nil {
|
||||
return models.JobStats{}, fmt.Errorf("job '%s' can not be enqueued, please check the job metatdata", jobName)
|
||||
}
|
||||
|
||||
res := generateResult(j.Job, job.JobKindScheduled, isUnique)
|
||||
res.Stats.RunAt = j.RunAt
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user