internal/worker: remove bq quota error remediation
This error does not occurr anymore and it should not as we are now
looking for a single work version per scan request, rather than fetching
for all work versions at server start-up.
Change-Id: I423f30f3fc72444bcdb72f2ebfd5d52c2388d1d6
Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/503835
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Maceo Thompson <maceothompson@google.com>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
diff --git a/internal/worker/analysis.go b/internal/worker/analysis.go
index ea480d3..4793398 100644
--- a/internal/worker/analysis.go
+++ b/internal/worker/analysis.go
@@ -159,11 +159,6 @@
}
wv, err := analysis.ReadWorkVersion(ctx, s.bqClient, module_path, version, binary)
if err != nil {
- if isReadPreviousWorkQuotaError(err) {
- log.Info(ctx, "hit bigquery list quota when reading work version, sleeping 1 minute...")
- // Sleep a minute to allow quota limitations to clear up.
- time.Sleep(60 * time.Second)
- }
return err
}
if wv != nil {
diff --git a/internal/worker/govulncheck_scan.go b/internal/worker/govulncheck_scan.go
index fa65480..98d8a61 100644
--- a/internal/worker/govulncheck_scan.go
+++ b/internal/worker/govulncheck_scan.go
@@ -13,7 +13,6 @@
"path/filepath"
"regexp"
"strings"
- "time"
"cloud.google.com/go/storage"
"golang.org/x/exp/event"
@@ -141,11 +140,6 @@
}
ws, err := govulncheck.ReadWorkState(ctx, h.bqClient, module_path, version)
if err != nil {
- if isReadPreviousWorkQuotaError(err) {
- log.Info(ctx, "hit bigquery list quota when reading work version, sleeping 1 minute...")
- // Sleep a minute to allow quota limitations to clear up.
- time.Sleep(60 * time.Second)
- }
return err
}
if ws != nil {
diff --git a/internal/worker/scan.go b/internal/worker/scan.go
index 6728ff0..b686bd8 100644
--- a/internal/worker/scan.go
+++ b/internal/worker/scan.go
@@ -26,7 +26,6 @@
"golang.org/x/pkgsite-metrics/internal/log"
"golang.org/x/pkgsite-metrics/internal/modules"
"golang.org/x/pkgsite-metrics/internal/proxy"
- "google.golang.org/api/googleapi"
)
const (
@@ -306,12 +305,3 @@
func isSyntheticLoad(err error) bool {
return strings.Contains(err.Error(), "synthetic")
}
-
-func isReadPreviousWorkQuotaError(err error) bool {
- var gerr *googleapi.Error
- if !errors.As(err, &gerr) {
- return false
- }
- // BigQuery uses 403 for quota exceeded.
- return gerr.Code == 403
-}