Code-review fixes: panics, retry, backoff, non-race build, partial detection #1
Loading…
Reference in a new issue
No description provided.
Delete branch "fixes/code-review"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Code-review fixes for the ipfs-search crawler, applied one by one. All build and tests pass locally (
go build ./...,go vet ./...,go test ./...).getFileStringFieldagainst empty/non-string metadata — Tika metadata is untrusted; an emptyContent-Typearray or non-string first element previously panicked the worker (no recover -> whole pool crash). Now returns""and logs.crawlDeliverywith a recover barrier so one bad item can't kill the worker goroutine permanently.log.Fatal—log.Fatalskipped deferredinstFlusher(Jaeger trace flush) andspan.End(); now returns the error to the caller.math/rand— under Go 1.19 (per go.mod) the global source defaults to seed 1, so every worker generated the identical queue-priority sequence. Seeded from the clock ininit().MaxRetries(default 3) via republish with anx-retry-countheader, then drops. AddsPublishWithHeadersto the AMQP queue andMaxRetriesconfig plumbed through the pool.-race— the runtime image shipped the race detector (2-10x overhead, hard-crash on race). Race tests moved to an optionalteststage (docker build --target test).PartialSize=0didn't disable it. Now only applies to files, skips whenPartialSize==0, and logs when triggered.sniffer.goand unreachableconst debug bool = falselog blocks in the index packages.Test plan
go build ./...go vet ./...go test ./...(all packages pass)docker build --target test -t ipfs-search:test .(race tests, needs live infra for some)docker build -t ipfs-search .(clean runtime image)Generated with Devin