-
Notifications
You must be signed in to change notification settings - Fork 113
Timers (or how to do setInterval and clearInterval in Elixir / Erlang?) #225
Copy link
Copy link
Open
Labels
T25mTime Estimate 25 MinutesTime Estimate 25 MinutesdiscussShare your constructive thoughts on how to make progress with this issueShare your constructive thoughts on how to make progress with this issueelixirPull requests that update Elixir codePull requests that update Elixir codeenhancementNew feature or enhancement of existing functionalityNew feature or enhancement of existing functionalityhelp wantedIf you can help make progress with this issue, please comment!If you can help make progress with this issue, please comment!priority-2Second highest priority, should be worked on as soon as the Priority-1 issues are finishedSecond highest priority, should be worked on as soon as the Priority-1 issues are finishedquestionA question needs to be answered before progress can be made on this issueA question needs to be answered before progress can be made on this issueresearchResearch required; be specificResearch required; be specifictechnicalA technical issue that requires understanding of the code, infrastructure or dependenciesA technical issue that requires understanding of the code, infrastructure or dependencies
Metadata
Metadata
Assignees
Labels
T25mTime Estimate 25 MinutesTime Estimate 25 MinutesdiscussShare your constructive thoughts on how to make progress with this issueShare your constructive thoughts on how to make progress with this issueelixirPull requests that update Elixir codePull requests that update Elixir codeenhancementNew feature or enhancement of existing functionalityNew feature or enhancement of existing functionalityhelp wantedIf you can help make progress with this issue, please comment!If you can help make progress with this issue, please comment!priority-2Second highest priority, should be worked on as soon as the Priority-1 issues are finishedSecond highest priority, should be worked on as soon as the Priority-1 issues are finishedquestionA question needs to be answered before progress can be made on this issueA question needs to be answered before progress can be made on this issueresearchResearch required; be specificResearch required; be specifictechnicalA technical issue that requires understanding of the code, infrastructure or dependenciesA technical issue that requires understanding of the code, infrastructure or dependencies
I'm making a few million
APIrequests 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 usesetIntervalto define the timeframe for executing theAPIrequestsand
clearIntervalonce they were complete.Not had to do this in
Elixirbefore, so doing a bit of googling ... 🔍Reading:
https://stackoverflow.com/questions/43892784/what-are-the-equivalent-of-settimeout-and-setinterval-in-elixir
The recommended
Erlangfunction 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 ...