populator v0.5.0 Populator.Looper
Summary
Functions
Start a looper that runs Populator.run/3 on every loop. Example
Functions
Start a looper that runs Populator.run/3 on every loop. Example:
Populator.Looper.run step: 30000, name: :my_looper, run_args: run_args
To be added to a supervisor hierarchy wrapped in a Task, like this:
worker(Task, [Populator.Looper,:run,[args]])
run_argsare the arguments expected byPopulator.run/3max_loopsbelow zero implies forever loop (default -1).:okis returned if:max_loopsreached.stepis in milliseconds, time to sleep between loops (default 30000)nameis the name to be registered with (not given means not registered)State can be accessed using an
Agentregistered as:my_looper_agent("#{args[:name]}_agent").This can be useful if you need to change any of the given arguments after the loop is started. Any changes over that state are used in the next iteration of the loooper. Agent updates are atomic, so any update you will be fully applied, or no applied at all (i.e. will be applied from the next iteration on).