mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
fix(cve): fix trivyDB being downloaded multiple times in a loop (#1255)
The condition to generate trivyDB download tasks was bugged, and new tasks were generated in case the download had already been successful (state `done`). Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
This commit is contained in:
@@ -91,7 +91,7 @@ func (gen *trivyTaskGenerator) GenerateTask() (scheduler.Task, error) {
|
||||
|
||||
gen.lock.Lock()
|
||||
|
||||
if gen.status != running && time.Since(gen.lastTaskTime) >= gen.waitTime {
|
||||
if gen.status == pending && time.Since(gen.lastTaskTime) >= gen.waitTime {
|
||||
newTask = newTrivyTask(gen.interval, gen.cveInfo, gen, gen.log)
|
||||
gen.status = running
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user