Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Function called automatically after a given time in erlang

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?

like image 618
Geek Avatar asked Mar 08 '26 14:03

Geek


1 Answers

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.

like image 140
Pascal Avatar answered Mar 10 '26 15:03

Pascal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!