View Source Dragonfly.Pool (dragonfly v0.1.4)

Manages a pool of Dragonfly.Runner's.

Pools support elastic growth and shrinking of the number of runners.

Examples

children = [
  ...,
  {Dragonfly.Pool, name: MyRunner, min: 1, max: 10, max_concurrency: 100}
]

See start_link/1 for supported options.

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts a pool of runners.

Functions

Link to this function

call(name, func, opts \\ [])

View Source

TODO

Returns a specification to start this module under a supervisor.

See Supervisor.

Starts a pool of runners.

Options

  • :name - The name of the pool, for example: MyApp.FFMPegRunner

  • :min - The minimum number of runners to keep in the pool at all times. For "scale to zero" behavior you may pass 0. When starting as a dragonfly child, the :min will be forced to zero to avoid recursively starting backend resources.

  • :max - The maximum number of runners to elastically grow to in the pool.

  • :max_concurrency - The maximum number of concurrent executions per runner before booting new runners or queueing calls. Defaults to 100.

  • :single_use - if true, runners will be terminated after each call completes. Defaults false.

  • :backend - The backend to use. Defaults to the configured :dragonfly, :backend or Dragonfly.LocalBackend if not configured.

  • :log - The log level to use for verbose logging. Defaults to false.

  • :timeout - The time to allow functions to execute on a remote node. Defaults to 30 seconds. This value is also used as the default Dragonfly.call/3 timeout for the caller.

  • :boot_timeout - The time to allow for booting and connecting to a remote node. Defaults to 30 seconds.

  • :shutdown_timeout - The time to allow for graceful shutdown on the remote node. Defaults to 30 seconds.

  • :idle_shutdown_after - The amount of time and function check to idle a remote node down after a period of inactivity. Defaults to 30 seconds. A tuple may also be passed to check a spefici condition, for example:

    {10_000, fn -> Supervisor.which_children(MySup) == []}