Timers (or how to do setInterval
and clearInterval
in Elixir
/ Erlang
?)
#225
Labels
discuss
Share your constructive thoughts on how to make progress with this issue
elixir
Pull requests that update Elixir code
enhancement
New feature or enhancement of existing functionality
help wanted
If you can help make progress with this issue, please comment!
priority-2
Second highest priority, should be worked on as soon as the Priority-1 issues are finished
question
A question needs to be answered before progress can be made on this issue
research
Research required; be specific
T25m
Time Estimate 25 Minutes
technical
A technical issue that requires understanding of the code, infrastructure or dependencies
I'm making a few million
API
requests to get some data dwyl/who#17and need to control the request frequency to avoid hitting rate limits ... ⏳ (
5k/hour
->120k/day
->3.65m/month
)In
JS
-land I would just usesetInterval
to define the timeframe for executing theAPI
requestsand
clearInterval
once they were complete.Not had to do this in
Elixir
before, so doing a bit of googling ... 🔍Reading:
https://stackoverflow.com/questions/43892784/what-are-the-equivalent-of-settimeout-and-setinterval-in-elixir
The recommended
Erlang
function is:timer.apply_interval/4
:timer.apply_interval(1000, IO, :puts, ["weee"])
https://www.erlang.org/doc/apps/stdlib/timer.html
Need to write myself a mini example ...
The text was updated successfully, but these errors were encountered: