Skip to content

Instantly share code, notes, and snippets.

@TylerPachal
Created November 9, 2017 18:32
Show Gist options
  • Save TylerPachal/8f3103602ff682480a1dd5867582566e to your computer and use it in GitHub Desktop.
Save TylerPachal/8f3103602ff682480a1dd5867582566e to your computer and use it in GitHub Desktop.
A flakey worker that parses all incoming messages as integers
defmodule Parser do
use GenServer
def start_link() do
GenServer.start_link(__MODULE__, :ok, [])
end
def handle_call(message, _from, state) do
i = String.to_integer(message)
{:reply, i, state}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment