Skip to content

Commit

Permalink
vulnstore: fix gc live lock
Browse files Browse the repository at this point in the history
the previous query took an absurd amount of time to complete.
updated with a more performant query.

Signed-off-by: ldelossa <[email protected]>
  • Loading branch information
ldelossa authored and ldelossa committed Feb 5, 2021
1 parent 966de96 commit 20a4437
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmd/libvulnhttp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net/http"
"os"
"strings"
"time"

"github.com/crgimenes/goconfig"
"github.com/quay/zlog"
Expand Down Expand Up @@ -81,6 +82,9 @@ func confToLibvulnOpts(conf Config) *libvuln.Opts {
Migrations: true,
UpdaterSets: nil,
DisableBackgroundUpdates: conf.DisableBackgroundUpdates,
UpdateInterval: 30 * time.Second,
UpdateWorkers: 10,
UpdateRetention: 10,
}

return opts
Expand Down
2 changes: 1 addition & 1 deletion internal/vulnstore/postgres/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ WHERE array_length(ordered_ops.refs, 1) > $2;
`

deleteVulns = `
DELETE FROM vuln WHERE id NOT IN (SELECT vuln FROM uo_vuln);
DELETE FROM vuln WHERE NOT EXISTS (SELECT * FROM uo_vuln WHERE vuln.id = uo_vuln.vuln);
`
)

Expand Down

0 comments on commit 20a4437

Please sign in to comment.