Rate Limiting with Flow in Elixir

502 Views Asked by At

As part of a data flow, I'd like to download a list of files at 10 request / second. enter image description here

Is sleeping the thread as as done here the best approach?

case ExRated.check_rate(@endpoint, scale, limit) do
  {:ok, _} ->
    request.()

  {:error, _} ->
    :timer.sleep(1_000)
    rate_limit_access(request, opts)
end

Is it possible to do something like what's done with gen_stage here, or what's the best approach to rate limit sections using Flow?

0

There are 0 best solutions below