Is there any function in Erlang which gets called automatically after a given amount of time and once it is triggered it should automatically be called after given amount of time, there should be no need to trigger it again and again. I am writing a module in Erlang which does cleaning task on ejabberd server
. This module once triggered needs to be called daily automatically. Any pointers?
The library timer provide several functions:
apply_after, send_after
that allow to execute a function or send a message after a certain amount of time,
apply_interval, send_interval
that allow to execute a function or send a message periodically.
With a combination of apply_after and apply_interval or send interval you should be able to do what you want.