GenServer with 1 HTTP request per second
问题 I have made this genserver defmodule Recorder do use GenServer def start_link(args) do id = Map.get(args, :id) GenServer.start_link(__MODULE__, args, name: id) end def init(state) do schedule_fetch_call() {:ok, state} end def handle_info(:jpeg_fetch, state) do spawn(fn -> IO.inspect("I am being called") IO.inspect(DateTime.utc_now()) Fincher.request(:get, state.url) |> IO.inspect() end) schedule_fetch_call() {:noreply, Map.put(state, :run, true)} end defp schedule_fetch_call do Process.send