Skip to content

selfhost(queue): worker concurrency control (QUEUE_CONCURRENCY) #1201

Description

@JSONbored

Part of #977.

Currently the SQLite and Postgres queues process one job at a time (single pump loop). Add a QUEUE_CONCURRENCY env var (default 1) so operators can saturate multi-core machines and the AI provider concurrently.

Scope:

  • opts.concurrency param on createSqliteQueue and createPgQueue
  • Falls back to QUEUE_CONCURRENCY env var (integer, ≥1)
  • SQLite: multiple pump loops, each claiming via atomic status='pending' UPDATE
  • Postgres: multiple async loops, each claiming via FOR UPDATE SKIP LOCKED
  • stop() and drain() wait for active === 0
  • Full branch coverage on new paths

Metadata

Metadata

Assignees

Labels

gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions