Skip to content

Configuration

An app is configured entirely through the Ardiq(...) constructor:

from ardiq import Ardiq
app = Ardiq(
redis_url="redis://localhost:6379",
queue_name="emails",
priorities=["low", "default", "high"],
concurrency=32,
result_ttl_ms=600_000,
)
OptionDefaultDescription
redis_urlredis://localhost:6379Redis connection URL.
queue_name"default"Logical queue — namespaces all Redis keys for this app.
priorities["default"]Priority lane names, lowest-first. Higher lanes drain first.
concurrency16Max tasks running at once in a worker.
prefetchconcurrency * 2Max tasks held in memory; drives backpressure against Redis.
idle_timeout_ms60000When an unrenewed in-flight task may be reclaimed by another worker.
result_ttl_ms300000How long results live. 0 drops results immediately; a negative value keeps them forever.
burstFalseExit once the queue drains (also settable via app.burst or the CLI --burst).
serializermsgpackCallable[[Any], bytes] used to encode arguments and results.
deserializermsgpackCallable[[bytes], Any] used to decode them.
cron_poll_s1.0Seconds between re-checks of each @app.cron’s next fire time.

Each app/worker pair operates on one logical queue. Workers sharing a queue_name form a Redis consumer group and split the work between them. Use distinct names to isolate unrelated workloads on the same Redis instance.

The list is lowest-priority first. With ["low", "default", "high"], a worker drains high before default before low. A task’s lane comes from its @task(priority=...) default or a per-call .options(priority=...) override.

concurrency caps how many tasks execute simultaneously. prefetch caps how many are pulled into memory ahead of execution; a larger prefetch smooths bursts but holds more work off Redis. The default prefetch = concurrency * 2 is a sensible starting point.

A running task periodically renews its claim via a heartbeat. If a worker dies, its in-flight tasks stop renewing; after idle_timeout_ms another worker reclaims them (XAUTOCLAIM). Lower it for faster recovery, raise it if tasks legitimately run long without renewing.

Controls result retention:

  • positive — keep results this many ms (default 5 minutes).
  • 0 — don’t store results at all.
  • negative — keep results forever (you manage cleanup yourself).

See Serialization. Every process on a queue must use the same codec.

How often a running worker re-stages each recurring task’s next occurrence. The default of 1s is fine for minute-resolution cron; lower it only if you rely on short every= intervals.