A caller that resends CreateFAQEntry before the first call answers could
create several rows for the same standard question. Indexing runs inline and
the embedding call retries with exponential backoff, so one create can take
far longer than an impatient caller waits; meanwhile the duplicate-question
check only looked at ChunkStatusIndexed, so a sibling create still mid-flight
was invisible and every retry passed the check.
- Serialize concurrent creates of the same question behind a Redis SetNX
guard, keyed by tenant + knowledge base + question hash, with an in-process
fallback when Redis is unavailable so an outage cannot block FAQ authoring.
- Widen the duplicate check to every non-deleted status. This also fixes
ChunkStatusDefault entries, which are listed to users but never blocked
duplicates.
- Bound the indexing step of an interactive create so a degraded embedding
service cannot stretch the request out; bulk and background indexing keep
the full retry budget.
- Report a failed rollback instead of discarding the error, since a leftover
stored chunk is hidden from the list yet now matches the duplicate check.