internal/postgres: update imported-by counts in smaller batches

The worker periodically updates search_documents.imported_by_count
from the imports_unique table. It does so in batches to avoid locking
search_documents for too long.

Currently the batch size causes the update query to time out, so
reduce it.

Change-Id: If86d272f0677dbedab104e2e1e235d7f2e1e4b25
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/406296
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/postgres/search.go b/internal/postgres/search.go
index 3c71605..369c656 100644
--- a/internal/postgres/search.go
+++ b/internal/postgres/search.go
@@ -832,7 +832,7 @@
 
 // How many imported-by counts to update at a time.
 // A variable for testing.
-var countBatchSize = 20_000
+var countBatchSize = 5_000
 
 func (db *DB) UpdateSearchDocumentsImportedByCountWithCounts(ctx context.Context, counts map[string]int) (nUpdated int64, err error) {
 	defer derrors.WrapStack(&err, "UpdateSearchDocumentsImportedByCountWithCounts")