Skip to content

Instantly share code, notes, and snippets.

@micheleriva
Created November 10, 2018 16:26
Show Gist options
  • Save micheleriva/adc9280663fd5296a710532a3ee6a928 to your computer and use it in GitHub Desktop.
Save micheleriva/adc9280663fd5296a710532a3ee6a928 to your computer and use it in GitHub Desktop.
defmodule Processes do
alias __MODULE__
def sendRequest url do
case HTTPoison.post url, [], [], [timeout: 50_000, recv_timeout: 50_000] do
{:ok, %HTTPoison.Response{status_code: 200, headers: headers}}
-> IO.inspect headers
{:error, %HTTPoison.Error{reason: reason}}
-> IO.inspect {:error, reason}
end
end
def spawnProcesses number do
for _ <- 1..number do
spawn(fn -> sendRequest('http://localhost:3000/flip') end)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment