Rihanna v1.1.4 Rihanna.Config View Source

Global configuration for Rihanna.

Sensible defaults have been chosen for you but if you want, you can optionally override any of these values in your local configuration.

For example, to change the table name for jobs:

config :rihanna, jobs_table_name: "awesome_jobs"

Link to this section Summary

Functions

Restricts Rihanna to only running jobs that conform to the Rihanna behaviour

Toggle debug logging

The maximum number of simultaneously executing workers for a dispatcher

How often the dispatcher should poll the database for new jobs (in milliseconds)

The table name to use for Rihanna jobs

Specify the classid to use for advisory locks

Link to this section Functions

Restricts Rihanna to only running jobs that conform to the Rihanna behaviour.

Being able to call Rihanna with mod-fun-args is convenient but presets a very slight increase in attack surface area. Some people may want to turn this off, which you can do by setting this option to true.

Example

config :rihanna, behaviour_only: true

Toggle debug logging.

Rihanna logs nothing by default. By configuring Rihanna with debug: true and setting Logger’s log level to :debug, you can get much more information about what it is doing during operation to troubleshoot issues.

Example

config :rihanna, debug: true
Link to this function dispatcher_max_concurrency() View Source

The maximum number of simultaneously executing workers for a dispatcher.

50 is chosen as a sensible default. Tuning this might increase or decrease your throughput depending on a lot of factors including database churn and how many other dispatchers you are running.

Example

config :rihanna, dispatcher_max_concurrency: 25
Link to this function dispatcher_poll_interval() View Source

How often the dispatcher should poll the database for new jobs (in milliseconds).

Default is 100.

Note that that actual poll interval in practice will be close to but not exactly this number of milliseconds for two reasons:

  1. A small amount of processing time for dispatching jobs is not included and will be added to the poll interval.
  2. A small, random amount of jitter is added to prevent multiple dispatchers started simultaneously from hitting the database at the same time.

Example

config :rihanna, dispatcher_poll_interval: :timer.seconds(1)

The table name to use for Rihanna jobs.

config :rihanna, jobs_table_name: "my_jobs"
Link to this function pg_advisory_lock_class_id() View Source

Specify the classid to use for advisory locks.

Details

In Postgres, advisory locks are scoped to a classid.

Here we use a random classid to prevent potential collisions with other users of the advisory locking system.

In the unimaginably unlucky scenario that this conflicts with a lock classid that is already being used on your system, you can change the classid that Rihanna uses here.

Example

config :rihanna, pg_advisory_lock_class_id: 42