perf(ebooks): allow large backfill worker pools

This commit is contained in:
rxwatcher
2026-07-22 13:43:57 +02:00
parent 60ce7ed1a4
commit 537b3f6476
2 changed files with 12 additions and 6 deletions
+4 -3
View File
@@ -31,8 +31,9 @@ import (
const (
ebookMetadataImageProviderID = "ebook-metadata"
defaultEnrichBatchSize = 50
defaultEnrichBatchSize = 5000
defaultEnrichWorkers = 4
maxEnrichWorkers = 5000
defaultEnrichmentItemTimeout = 2 * time.Minute
)
@@ -69,8 +70,8 @@ func ebookEnrichWorkers() int {
n = parsed
}
}
if n > defaultEnrichBatchSize {
n = defaultEnrichBatchSize
if n > maxEnrichWorkers {
n = maxEnrichWorkers
}
return n
}
+8 -3
View File
@@ -69,9 +69,14 @@ func TestEbookEnrichWorkersFromEnv(t *testing.T) {
t.Fatalf("ebookEnrichWorkers() with zero = %d, want default %d", got, defaultEnrichWorkers)
}
t.Setenv("SILO_EBOOK_ENRICH_WORKERS", "999")
if got := ebookEnrichWorkers(); got != defaultEnrichBatchSize {
t.Fatalf("ebookEnrichWorkers() capped = %d, want %d", got, defaultEnrichBatchSize)
t.Setenv("SILO_EBOOK_ENRICH_WORKERS", "5000")
if got := ebookEnrichWorkers(); got != 5000 {
t.Fatalf("ebookEnrichWorkers() = %d, want 5000", got)
}
t.Setenv("SILO_EBOOK_ENRICH_WORKERS", "9999")
if got := ebookEnrichWorkers(); got != maxEnrichWorkers {
t.Fatalf("ebookEnrichWorkers() capped = %d, want %d", got, maxEnrichWorkers)
}
}