Best practices
- Make handlers idempotent. Delivery is at least once: a worker killed before its outcome was acknowledged has the task run again. A
unique_keystops a duplicate enqueue, not a second run. The context'sdedupe_key(dedupeKey,DedupeKey; not in PHP) is<workflow or job id>:<step or job name>:<attempt>: a key for side effects that must happen once per attempt. - Declare retries on workflow steps that may hit a crash. A step runs again after its worker dies only if it declares retries; list the errors that must not be retried in
retry.non_retryable. - Give long steps a heartbeat. Set
heartbeat_msand callctx.heartbeat()inside the work, so a hung handler is timed out instead of holding the step fortimeout_ms(24 h by default). - Use the right limit. Throttle a queue to protect workers; rate-limit a key to protect what your code calls. See Comparisons.
- Seal what is sensitive, and reach the gateway over HTTPS. Sealed fields travel in plain text from your app to the gateway.
- Keep secrets out of keys and names. Values with secret-looking keys are masked in the console; a search attribute whose name looks secret cannot be searched.
- Upgrade every engine together. Every process that conducts joobq-pro workflows on the same Redis runs joobq-pro 0.4.1 or later; upgrade every process before the first build promote.
- Size the database pool for every instance. Instances x
JOOBQUI_DB_POOL_SIZEmust stay under PostgreSQL'smax_connections. - Use a Redis that does not evict (
noevictionorvolatile-*) and persists (AOF or RDB). - Set
CRYSTAL_ENV=productionon every real deployment, andJOOBQUI_CLIENT_IP_HEADERbehind a proxy.