Created
November 10, 2018 16:26
-
-
Save micheleriva/adc9280663fd5296a710532a3ee6a928 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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