Skip to content

Commit 92f08f7

Browse files
committed
fixes linting
1 parent 931720e commit 92f08f7

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

internal/core/daemon/auto_reopen.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ func AutoReopenAcceptedVulnerabilities(db core.DB) error {
5050
return err
5151
}
5252

53-
// create a new vulnerability event for each vulnerability
54-
events := make([]models.VulnEvent, 0, len(vulnerabilities))
5553
for _, vuln := range vulnerabilities {
5654
// create a new event for the vulnerability
5755
event := models.NewReopenedEvent(vuln.ID, models.VulnTypeDependencyVuln, "system", fmt.Sprintf("Automatically reopened since the vulnerability was accepted more than %d days ago", *asset.VulnAutoReopenAfterDays))
58-
events = append(events, event)
5956

60-
dependencyVulnRepository.ApplyAndSave(nil, &vuln, &event)
61-
slog.Info("reopened vulnerability since it was accepted more than the configured time", "vulnerabilityID", vuln.ID, "assetID", asset.ID, "reopenAfterDays", *asset.VulnAutoReopenAfterDays)
57+
if err := dependencyVulnRepository.ApplyAndSave(nil, &vuln, &event); err != nil {
58+
slog.Error("failed to apply and save vulnerability event", "vulnerabilityID", vuln.ID, "error", err)
59+
} else {
60+
slog.Info("reopened vulnerability since it was accepted more than the configured time", "vulnerabilityID", vuln.ID, "assetID", asset.ID, "reopenAfterDays", *asset.VulnAutoReopenAfterDays)
61+
}
6262
}
6363
}
6464

0 commit comments

Comments
 (0)