aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres
diff options
context:
space:
mode:
authorJulie Qiu <julie@golang.org>2020-09-02 11:08:51 -0400
committerJulie Qiu <julie@golang.org>2020-09-02 18:52:04 +0000
commit116a596a5431373e36d151fe933d6541d7f02ae6 (patch)
treed6b21e75fa86f4482a96f71c0bd075d887f1c515 /internal/postgres
parent580f0e7b9f9ee550c5e0f388aa4904aa550e146c (diff)
downloadgo-x-pkgsite-116a596a5431373e36d151fe933d6541d7f02ae6.tar.xz
internal/postgres: do not reprocess 490s and 491s
Bad modules and alternative modules do not need to be reprocessed, and are no longer marked for reprocessing. Modules in the reprocess state for those statuses (540 and 541s) will continue be requeued so that we don't end up having two status codes that indicate the same thing. Once all 540s and 541s have been updated, we can delete those error codes. Change-Id: I804c021421e8a8e19be49992d9113ea832d35a9b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/252679 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'internal/postgres')
-rw-r--r--internal/postgres/requeue.go2
-rw-r--r--internal/postgres/requeue_test.go6
2 files changed, 2 insertions, 6 deletions
diff --git a/internal/postgres/requeue.go b/internal/postgres/requeue.go
index d9ecf5a4..bea82d2a 100644
--- a/internal/postgres/requeue.go
+++ b/internal/postgres/requeue.go
@@ -24,8 +24,6 @@ func (db *DB) UpdateModuleVersionStatesForReprocessing(ctx context.Context, appV
for _, status := range []int{
http.StatusOK,
derrors.ToStatus(derrors.HasIncompletePackages),
- derrors.ToStatus(derrors.BadModule),
- derrors.ToStatus(derrors.AlternativeModule),
derrors.ToStatus(derrors.DBModuleInsertInvalid),
} {
if err := db.UpdateModuleVersionStatesWithStatus(ctx, status, appVersion); err != nil {
diff --git a/internal/postgres/requeue_test.go b/internal/postgres/requeue_test.go
index 17f3360c..7a4c1749 100644
--- a/internal/postgres/requeue_test.go
+++ b/internal/postgres/requeue_test.go
@@ -39,8 +39,6 @@ func TestGetNextModulesToFetchAndUpdateModuleVersionStatesForReprocessing(t *tes
statuses = []int{
http.StatusOK,
derrors.ToStatus(derrors.HasIncompletePackages),
- derrors.ToStatus(derrors.AlternativeModule),
- derrors.ToStatus(derrors.BadModule),
derrors.ToStatus(derrors.DBModuleInsertInvalid),
http.StatusInternalServerError,
http.StatusBadRequest,
@@ -151,7 +149,7 @@ func TestGetNextModulesToFetchAndUpdateModuleVersionStatesForReprocessing(t *tes
// The first modules to requeue should be the latest version of not-large modules with errors
// ReprocessStatusOK ReprocessHasIncompletePackages, ReprocessAlternative, and ReprocessBadModule.
- statuses = []int{200, 290, 480, 490, 491}
+ statuses = []int{200, 290, 480}
want = generateMods([]string{latest}, []int{small}, statuses)
// The next modules to requeue should be the small non-latest versions.
@@ -165,7 +163,7 @@ func TestGetNextModulesToFetchAndUpdateModuleVersionStatesForReprocessing(t *tes
checkNextToRequeue(want, len(mods))
// Take modules in groups by passing a limit.
- const limit = 6
+ limit := len(statuses) + 1
for i := 0; i < len(mods); i += limit {
end := i + limit
if end > len(want) {