fix(wiki-ingest,asynqdl): review fixups for PR #1241

- repo: drop r.db.Debug() from FindSimilarPages — it was dumping every
  trigram probe's SQL+args (per-alias, per-item) into production logs.
- wiki_ingest dedup: fix Printf format string ("selected for %d new
  items" had two args), and harden validMerge against un-prefixed
  slugs whose strings.Index returned -1 and silently passed the type
  check.
- wiki_ingest_batch: drop the duplicated loggedBatchSize/MapPar/
  ReducePar assignments.
- asynqdl: record the real attempt count (retried + 1) on the dead
  letter row instead of a hard-coded 0; tighten payloadProbe to the
  set of field names with consistent semantics across payloads
  (drop source_id/target_id/target_kb_id which differ by task type).
- asynqdl tests: update for the trimmed probe and assert FailCount=0
  outside an asynq worker ctx so the semantics stay pinned.
This commit is contained in:
wizardchen
2026-05-09 23:59:12 +08:00
committed by lyingbug
parent 04e8105728
commit 82947c726e
5 changed files with 63 additions and 35 deletions
@@ -223,9 +223,6 @@ func (s *wikiIngestService) ProcessWikiIngest(ctx context.Context, t *asynq.Task
loggedBatchSize = batchSize
loggedMapPar = mapParallel
loggedReducePar = reduceParallel
loggedBatchSize = batchSize
loggedMapPar = mapParallel
loggedReducePar = reduceParallel
lang := types.LanguageNameFromContext(ctx)
@@ -254,9 +251,9 @@ func (s *wikiIngestService) ProcessWikiIngest(ctx context.Context, t *asynq.Task
// callers pay only for the slugs / knowledge ids they actually
// reach for. Cache hits keep repeat lookups within the batch free.
var (
fetchMu sync.Mutex
slugTitleCache = make(map[string]string) // slug -> title; "" = known-missing
summaryKIDCache = make(map[string]string) // kid -> content; "" = known-missing
fetchMu sync.Mutex
slugTitleCache = make(map[string]string) // slug -> title; "" = known-missing
summaryKIDCache = make(map[string]string) // kid -> content; "" = known-missing
)
resolveSlugs := func(ctx context.Context, slugs []string) map[string]string {
@@ -351,7 +348,7 @@ func (s *wikiIngestService) ProcessWikiIngest(ctx context.Context, t *asynq.Task
m := resolveSlugs(ctx, []string{slug})
return m[slug]
},
SlugTitleMany: resolveSlugs,
SlugTitleMany: resolveSlugs,
SummaryContentByKnowledgeID: func(ctx context.Context, kid string) string {
m := resolveSummaries(ctx, []string{kid})
return m[kid]