EctoJob.Config (ecto_job v3.1.0) View Source
EctoJob Configuration struct.
Configuration may be provided directly to your JobQueue supervisor:
supervisor(MyApp.JobQueue, [[repo: MyApp.Repo, max_demand: 100, log_level: :debug]])
Or if the configuration should be environment-specific, use Mix config:
config :ecto_job,
repo: MyApp.Repo,
max_demand: 100,
log_level: :debug
Otherwise default values will be used.
Configurable values:
repo
: (Required) TheEcto.Repo
module in your application to use for accessing theJobQueue
max_demand
: (Default100
) The number of concurrent worker processes to use, seeConsumerSupervisor
for more detailslog
: (Defaulttrue
) Enables logging using the standard ElixirLogger
modulelog_level
: (Default:info
) The level used to log messages, see Loggerpoll_interval
: (Default60_000
) Time in milliseconds between polling theJobQueue
for scheduled jobs or jobs due to be retriedreservation_timeout
: (Default60_000
) Time in ms during which aRESERVED
job state is held while waiting for a worker to start the job. Subsequent polls will return the job to theAVAILABLE
state for retry.execution_timeout
: (Default300_000
) Time in ms that a worker is allotted to hold a job in theIN_PROGRESS
state before subsequent polls return a job to theAVAILABLE
state for retry. The timeout is extended byexecution_timeout
for every retry attempt untilmax_attemps
is reached for a given job.retry_timeout
: (Default30_000
) Time in ms that a job will stay in theRETRY
state before subsequent polls return a job to theAVAILABLE
state for retry. The timeout is extended byretry_timeout
for every retry attempt untilmax_attemps
is reached for a given job.notifications_listen_timeout
: (Default5_000
) Time in milliseconds that Notifications.listen!/3 is alloted to start listening to notifications from postgrex for new jobs
Link to this section Summary
Link to this section Types
Link to this section Functions
Specs
Constructs a new Config
from params, falling back to Application environment then to default values.
Example
iex> EctoJob.Config.new(repo: MyApp.Repo, log: false)
%EctoJob.Config{
repo: MyApp.Repo,
max_demand: 100,
log: false,
log_level: :info,
poll_interval: 60_000,
reservation_timeout: 60_000,
retry_timeout: 30_000,
execution_timeout: 300_000,
notifications_listen_timeout: 5_000
}