Skip to main content
Schedule functions to execute at specific times using cron expressions.

Sample Configuration

Configuration

adapter
Adapter
The adapter to use for distributed locking. Defaults to kv. Use redis for multi-instance deployments.

Adapters

kv

When running multiple engine instances, the kv adapter does not provide reliable distributed locking — the same cron job may execute on every instance simultaneously. Use the redis adapter for multi-instance deployments.
Built-in adapter using process-local locks. Suitable for single-instance deployments.

Configuration

lock_ttl_ms
integer
Duration in milliseconds for which a lock is held before it expires. Defaults to 30000 (30 seconds).
lock_index
string
Key namespace used to store lock entries in the KV store. Defaults to cron_locks.

redis

Uses Redis for distributed locking to prevent duplicate job execution across multiple engine instances.

Configuration

redis_url
string
The URL of the Redis instance to use for distributed locking.

Trigger Type

This Worker adds a new Trigger Type: cron.

Sample Code

Common Cron Expressions

Distributed Execution

When running multiple iii Engine instances, the Cron Worker uses distributed locking to ensure jobs execute only once: