Skip to content

Instantly share code, notes, and snippets.

@rnewson
Created September 5, 2014 17:12
Show Gist options
  • Save rnewson/9eb82c8e8decf1cdfe60 to your computer and use it in GitHub Desktop.
Save rnewson/9eb82c8e8decf1cdfe60 to your computer and use it in GitHub Desktop.
diff --git a/src/ioq.erl b/src/ioq.erl
index 4983b73..b761a0b 100644
--- a/src/ioq.erl
+++ b/src/ioq.erl
@@ -37,7 +37,12 @@ start_link() ->
call(Fd, Msg, Priority) ->
Request = #request{fd=Fd, msg=Msg, priority=Priority, from=self()},
- gen_server:call(?MODULE, Request, infinity).
+ try
+ gen_server:call(?MODULE, Request, infinity)
+ catch
+ exit:{noproc,_} ->
+ gen_server:call(Fd, Msg, infinity)
+ end.
init(_) ->
Ratio = list_to_float(config:get("ioq", "ratio", "0.01")),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment