Skip to content

Commit

Permalink
Merge pull request #5 from findmypast-oss/genserver_timeout
Browse files Browse the repository at this point in the history
Adding query timeout to the ODBC Genserver.call
  • Loading branch information
Jae Bach Hardie committed Apr 28, 2017
2 parents 0f20de1 + a02a2cc commit 5ac75cd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/mssqlex/odbc.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ defmodule Mssqlex.ODBC do
def query(pid, statement, params) do
if Process.alive?(pid) do
GenServer.call(pid,
{:query, %{statement: IO.iodata_to_binary(statement), params: params}})
{:query, %{statement: IO.iodata_to_binary(statement), params: params}},
Keyword.get(params, :timeout, 5000))
else
{:error, %Mssqlex.Error{message: :no_connection}}
end
Expand Down

0 comments on commit 5ac75cd

Please sign in to comment.