Storehouse.Runner.Memory (Storehouse v0.2.0)

Copy Markdown View Source

A runner (Storehouse.Runner) in a process of the app's: each job run beside the app's requests, and when it fails, again after a while (a second, then twice as long each time, up to five minutes), up to its :max_attempts. Then it is given up (Storehouse.Job.discarded/3).

# lib/my_app/application.ex
children = [
  MyApp.Repo,
  {Storehouse.Runner.Memory, max_concurrency: 8},
  MyAppWeb.Endpoint
]

Its jobs live in this process: those not done when the app stops are not done. Storehouse.Runner.Oban keeps them in the database.

Without the process, a job runs at once, in the caller, and once.

A job runs with the processes of the caller that gave it as its $callers, so it sees what they own: a test's files in Storehouse.Memory.

Options

  • :max_concurrency - how many jobs run at once. The default is 4.
  • :max_attempts - how many times a job is tried, in place of each job's own (10).
  • :backoff - a function of the attempt that failed (1, 2, …) that gives the wait before the next, in milliseconds.
  • :name - the default is Storehouse.Runner.Memory; a job's runner {Storehouse.Runner.Memory, name: …} names another.

Summary

Functions

Starts the runner, registered as Storehouse.Runner.Memory (or its :name).

Functions

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Starts the runner, registered as Storehouse.Runner.Memory (or its :name).