View Source Bella.PeriodicTask (bella v0.0.6)
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 Bella.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
Examples
Registering a task
iex> Bella.PeriodicTask.new(:pod_evictor, {PodEvictor, :evict, [reconcile_payload_map]}, 5000)
Unregistering a task
iex> Bella.PeriodicTask.unregister(:pod_evictor)
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Registers and starts a new task given Bella.PeriodicTask
attributes
Registers and starts a new Bella.PeriodicTask
Unregisters and stops a Bella.PeriodicTask
Link to this section Types
Specs
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Specs
new(binary(), (... -> any()) | {atom(), atom(), byte()}, pos_integer()) :: {:error, any()} | {:ok, pid()}
Registers and starts a new task given Bella.PeriodicTask
attributes
Specs
Registers and starts a new Bella.PeriodicTask
Specs
Specs
Unregisters and stops a Bella.PeriodicTask