Revert "internal/postgres: process new modules in arrival order"

This reverts commit 61bac80a3d.

Reason for revert: if we queue in arrival order, then multiple versions of the same module that are published together (which seems to happen a lot) will be queued together, and will conflict with each other on the module path lock.

We'll have to remove the processing lag alert, but instead we'll alert on total backlog, which is more robust anyway.

Change-Id: Ia1f9f5c7ec8b0b6577527d3dd6060b692c7a7b28
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/323172
Trust: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
This commit is contained in:
Jonathan Amsterdam 2021-05-27 18:51:24 +00:00
Родитель 70b60010dc
Коммит fa37119cbf
2 изменённых файлов: 1 добавлений и 3 удалений

Просмотреть файл

@ -235,8 +235,6 @@ const nextModulesToProcessQuery = `
WHEN status = 540 OR status = 541 OR status = 542 THEN 4
ELSE 5
END,
-- process new modules in the order they arrived at the index
CASE WHEN status = 0 THEN index_timestamp ELSE CURRENT_TIMESTAMP END,
md5(module_path||version) -- deterministic but effectively random
LIMIT $1
`

Просмотреть файл

@ -68,8 +68,8 @@ func TestModuleVersionState(t *testing.T) {
}
wantVersions := []*internal.ModuleVersionState{
{ModulePath: "foo.com/bar", Version: "v1.0.0", IndexTimestamp: fooVersion.Timestamp},
{ModulePath: "baz.com/quux", Version: "v2.0.1", IndexTimestamp: bazVersion.Timestamp},
{ModulePath: "foo.com/bar", Version: "v1.0.0", IndexTimestamp: fooVersion.Timestamp},
}
ignore := cmpopts.IgnoreFields(internal.ModuleVersionState{}, "CreatedAt", "LastProcessedAt", "NextProcessedAfter")
if diff := cmp.Diff(wantVersions, gotVersions, ignore); diff != "" {