aboutsummaryrefslogtreecommitdiff
path: root/internal/queue/queue.go
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2020-06-23 09:26:37 -0400
committerJonathan Amsterdam <jba@google.com>2020-06-26 20:39:55 +0000
commit35d44197af7f48418271f5bcb637fe55fd94b1dd (patch)
treeea04145d44ac8395bb529aa47b4db7a5d2d31c0a /internal/queue/queue.go
parent8be274654d9360fdee9e9fcb6ccf8e16d81955b4 (diff)
downloadgo-x-pkgsite-35d44197af7f48418271f5bcb637fe55fd94b1dd.tar.xz
internal/postgres: get next modules to fetch in one query
Construct a single query that returns all the modules we want to reprocess, in the order we want. The main ideas are: - Use a WITH statement (CTE) to construct a table of (module path, latest version). - Add a computed "latest" column to every row by testing membership in that table. - Use a CASE in the ORDER BY clause to express the ordering we want. Some other changes: - We process status 0 first (the original motivation for this CL). - As a consequence of using one query, we'll always return a number of results. up to the limit. To handle the lower limit for large modules, we add code to truncate the results. - Before, all 5xx that were not one of the four special codes were processed after everything else. Now it's relatively easy to process other 5xx codes at the end of each category (latest versions, non-large modules). Change-Id: I4dacb093cfb93299ccfc8d29c1fd0b1cb49bf56f Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/239479 Reviewed-by: Julie Qiu <julie@golang.org>
Diffstat (limited to 'internal/queue/queue.go')
0 files changed, 0 insertions, 0 deletions