From 116a596a5431373e36d151fe933d6541d7f02ae6 Mon Sep 17 00:00:00 2001 From: Julie Qiu Date: Wed, 2 Sep 2020 11:08:51 -0400 Subject: 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 TryBot-Result: kokoro Reviewed-by: Jonathan Amsterdam --- internal/postgres/requeue.go | 2 -- internal/postgres/requeue_test.go | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'internal/postgres') 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) { -- cgit v1.3-5-g9baa