View Source Bonny.PeriodicTask (bonny v1.4.0)
Register periodically run tasks. Use for running tasks as a part of reconciling a CRD with a lifetime, duration, or interval field.
Note: Must be started by your operator.
Add Bonny.PeriodicTask.sttart_link(:ok)
to your application.
Functions are expected to return one of:
:ok
- task will be passed to subsequent calls{:ok, new_state}
state field will be updated in task and provided to next call{:stop, reason}
task will be removed from execution loop. Use for tasks opting out of being re-runany()
- any other result is treated as an error, and the execution loop will be halted
Examples
Registering a task
iex> Bonny.PeriodicTask.new(:pod_evictor, {PodEvictor, :evict, [reconcile_payload_map]}, 5000)
Unregistering a task
iex> Bonny.PeriodicTask.unregister(:pod_evictor)
Summary
Functions
Returns a specification to start this module under a supervisor.
Registers and starts a new task given Bonny.PeriodicTask
attributes
Registers and starts a new Bonny.PeriodicTask
Unregisters and stops a Bonny.PeriodicTask
Types
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec new(binary() | atom(), mfa() | (... -> any()), pos_integer()) :: {:ok, pid()} | {:error, term()}
Registers and starts a new task given Bonny.PeriodicTask
attributes
Registers and starts a new Bonny.PeriodicTask
Unregisters and stops a Bonny.PeriodicTask