Durable.Config (Durable v0.1.0-rc)
View SourceConfiguration management for Durable.
Durable configuration is validated at startup and stored in persistent_term for fast runtime access.
Options
:repo- The Ecto repo module to use for persistence (required):name- Instance name for multiple Durable instances (default:Durable):prefix- PostgreSQL schema name for table isolation (default:"durable"):queues- Queue configuration map (default:%{default: [concurrency: 10, poll_interval: 1000]}):queue_enabled- Enable/disable queue processing (default:true):stale_lock_timeout- Seconds before a lock is considered stale (default:300):heartbeat_interval- Milliseconds between worker heartbeats (default:30_000):log_level- Log level for Ecto queries, orfalseto disable (default:false)
Examples
# Single instance (most common)
{Durable, repo: MyApp.Repo}
# With custom queues
{Durable,
repo: MyApp.Repo,
queues: %{
default: [concurrency: 10],
high_priority: [concurrency: 20, poll_interval: 500]
}}
# Multiple instances with different prefixes
{Durable, repo: MyApp.Repo, name: :workflows_a, prefix: "durable_a"}
{Durable, repo: MyApp.Repo, name: :workflows_b, prefix: "durable_b"}
Summary
Functions
Removes the configuration for a Durable instance.
Retrieves the configuration for a Durable instance.
Retrieves the configuration, returning nil if not set.
Gets the heartbeat interval for a Durable instance.
Creates a new validated configuration from options.
Creates a new validated configuration, raising on error.
Gets the database prefix for a Durable instance.
Stores the configuration for a Durable instance.
Checks if queue processing is enabled for a Durable instance.
Gets the queues configuration for a Durable instance.
Gets the repo module for a Durable instance.
Returns the NimbleOptions schema for documentation.
Gets the stale lock timeout for a Durable instance.
Returns the Task.Supervisor name for a Durable instance.
Types
@type t() :: %Durable.Config{ heartbeat_interval: pos_integer(), log_level: false | :debug | :info | :warning | :error, name: atom(), owns_pubsub?: boolean(), prefix: String.t(), pubsub: atom() | nil, queue_enabled: boolean(), queues: map(), repo: module(), scheduled_modules: [module()], scheduler_interval: pos_integer(), sleep_waker_batch_size: pos_integer(), sleep_waker_interval: pos_integer(), stale_lock_timeout: pos_integer() }
Functions
@spec delete(atom()) :: :ok
Removes the configuration for a Durable instance.
Retrieves the configuration for a Durable instance.
Raises if the configuration hasn't been set.
Retrieves the configuration, returning nil if not set.
@spec heartbeat_interval(atom()) :: pos_integer()
Gets the heartbeat interval for a Durable instance.
@spec new(keyword()) :: {:ok, t()} | {:error, NimbleOptions.ValidationError.t()}
Creates a new validated configuration from options.
Returns {:ok, config} if valid, {:error, reason} otherwise.
Respects the :durable app env key :disable_queue_processing. When
set to true, it forces queue_enabled: false regardless of the
user's opts. Mix tasks set this before booting the host app so they
don't accidentally claim jobs they can't finish.
Creates a new validated configuration, raising on error.
Gets the database prefix for a Durable instance.
Stores the configuration for a Durable instance.
Configuration is stored in persistent_term for fast lookups.
Checks if queue processing is enabled for a Durable instance.
Gets the queues configuration for a Durable instance.
Gets the repo module for a Durable instance.
@spec schema() :: keyword()
Returns the NimbleOptions schema for documentation.
@spec stale_lock_timeout(atom()) :: pos_integer()
Gets the stale lock timeout for a Durable instance.
Returns the Task.Supervisor name for a Durable instance.
This supervisor is used for parallel step execution.