Tarearbol.ensure

You're seeing just the function ensure, go back to Tarearbol module for more information.

Specs

ensure(
  (() -> any()) | {atom(), atom(), list()},
  keyword()
) :: {:error, any()} | {:ok, any()}

Ensures the task to be completed; restarts it when necessary.

Possible options:

  • attempts [default: :infinity] Might be any of @Tarearbol.Utils.interval type (5 for five attempts, :random for the random amount etc)
  • delay [default: 1 msec]. Might be any of @Tarearbol.Utils.interval type (1_000 or 1.0 for one second, :timeout for five seconds etc)
  • on_success [default: nil], the function to be called on successful execution (arity ∈ [0, 1] or tuple {Mod, fun} where fun is of arity zero or one.) When the arity of given function is 1, the result of task execution is passed
  • on_retry [default: nil], same as above, called on retries after insuccessful attempts or one of [:debug, :info, :warn, :error] atoms to log a retry with default logger
  • on_fail [default: nil], same as above, called when the task finally failed after attempts amount of insuccessful attempts