View Source Rclex.Timer (Rclex v0.9.0)
For periodically execution of jobs. This module supervises two supervisor tree, one is for job control, one is for timer loop.
There are 4 GenServers including this module itself. They work together as shown below.
+-------------+
| Rclex.Timer <-----------------------------+
+-----+-------+ |
| | GenServer.cast to Rclex.Timer
| |
| +--------+----------+
| +-------+ Rclex.JobExecutor |
| | +--------^----------+
| | |
+------Supervisor----+ | GenServer.cast to JobExecutor
| | |
| | +--------+----------+
| +-------+ Rclex.JobQueue |
| +--------^----------+
| |
| | GenServer.cast to JobQueue
| |
| +--------+----------+
+------Supervisor------------+ Rclex.TimerLoop |
+-------------------+
- This module stored
callback
andargs
to be executed. Rclex.TimerLoop
triggers the execution according to thetime
[msec].- The number of executions is limited by
limit
.
- The number of executions is limited by
Summary
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec init( {callback :: function(), args :: any(), time :: integer(), timer_name :: charlist(), limit :: integer(), {queue_length :: integer(), change_order :: (list() -> list())}} ) :: {:ok, tuple()}
Initialize GenServer
Arguments in tuple
- callback: callback function
- args: callback arguments
- time: execution interval time, milli seconds
- limit: execution times limit
- queue_length: queue length for
Rclex.JobQueue
- change_order: change order function for
Rclex.JobExecutor