0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2025-02-17 23:45:36 -05: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:
Andrei Aaron 2023-03-10 20:08:53 +02:00 committed by GitHub
parent f04e66a5e2
commit c731acf6de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}