Fork me on GitHub
#babashka
<
2021-06-23
>
mmz14:06:30

What's the best way to throttle the number of calls to an API in babashka? I have a sequence of calls to make from babashka to an API, but I'm not allowed to just (run! #(cmd! %) command-collection) because the server will deny my calls if I execute them too fast. What's the best way to interleave my commands with something like a pause for x milliseconds?

lispyclouds14:06:13

off the top of my head 😛 (interleave [call1 call2 ...] (cycle [#(Thread/sleep 1000)]))

mmz14:06:37

Nice ... going to try that 🤓

mmz15:06:21

Yep, with a slight variation to fit my context, it works, thanks!

😄 4