feat(wiki): dedicated worker pool with concurrent claim-based batching
Isolate the wiki generation pipeline from the document parse pipeline so the two can no longer starve each other during concurrent uploads. - Dedicated asynq worker pool for QueueWiki (NewWikiAsynqServer) with its own concurrency budget (WEKNORA_WIKI_ASYNQ_CONCURRENCY / asynq.wiki_ concurrency, default 16), split from the parse pool (NewParseAsynqServer). Both run the same mux over disjoint queue sets. Replaces the old weighted-lottery approach where wiki sat on the low queue (weight 1). - Task queue: add ClaimBatch (SELECT ... FOR UPDATE SKIP LOCKED + claimed_at) and ReleaseByIDs so multiple concurrent consumers pull disjoint rows without an external per-KB lock; PeekBatch retained for Lite mode. - New TypeWikiFinalize debounced KB-global finalize task (index rebuild / dead-link cleanup / cross-linking), registered on both Redis and Lite paths. - Two-level wiki ingest concurrency: IngestMaxInflight caps concurrent batches per KB; Map/Reduce fan-out sized within a batch. New config knob + system setting + swagger docs.
This commit is contained in:
@@ -263,7 +263,13 @@ func BuildContainer(container *dig.Container) *dig.Container {
|
||||
redisAvailable := os.Getenv("REDIS_ADDR") != ""
|
||||
if redisAvailable {
|
||||
must(container.Provide(router.NewAsyncqClient, dig.As(new(interfaces.TaskEnqueuer))))
|
||||
must(container.Provide(router.NewAsynqServer))
|
||||
// Two independent asynq worker pools with separate concurrency budgets:
|
||||
// the parse pool (all queues except QueueWiki) and the wiki pool
|
||||
// (QueueWiki only). Hard capacity isolation so upstream parsing and the
|
||||
// downstream wiki pipeline can't starve each other during concurrent
|
||||
// uploads. Both run the same mux (see router.RunAsynqServer).
|
||||
must(container.Provide(router.NewParseAsynqServer, dig.Name("parseAsynqServer")))
|
||||
must(container.Provide(router.NewWikiAsynqServer, dig.Name("wikiAsynqServer")))
|
||||
// Asynq inspector for cancel-by-knowledge-id (best-effort
|
||||
// dequeue of pending/scheduled/retry tasks + active-task cancel).
|
||||
must(container.Provide(router.NewAsynqInspector))
|
||||
|
||||
Reference in New Issue
Block a user