Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge commit 'a50e24e3c30b1b0bddc3511eac5661d110885f6a'

Conflicts:
	src/poolboy.erl
  • Loading branch information...
commit fb9242b7e49399691cff8e2bd6378e9f8a8d3710 2 parents 6ddc61a + a50e24e
@devinus authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/poolboy.erl
View
11 src/poolboy.erl
@@ -4,8 +4,8 @@
-behaviour(gen_server).
-export([checkout/1, checkout/2, checkout/3, checkin/2, transaction/2,
- child_spec/2, child_spec/3, start/1, start/2, start_link/1,
- start_link/2, stop/1, status/1]).
+ transaction/3, child_spec/2, child_spec/3, start/1, start/2,
+ start_link/1, start_link/2, stop/1, status/1]).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
code_change/3]).
@@ -41,7 +41,12 @@ checkin(Pool, Worker) when is_pid(Worker) ->
-spec transaction(Pool :: node(), Fun :: fun((Worker :: pid()) -> any()))
-> any().
transaction(Pool, Fun) ->
- Worker = poolboy:checkout(Pool),
+ transaction(Pool, Fun, ?TIMEOUT).
+
+-spec transaction(Pool :: node(), Fun :: fun((Worker :: pid()) -> any()),
+ Timeout :: timeout()) -> any().
+transaction(Pool, Fun, Timeout) ->
+ Worker = poolboy:checkout(Pool, true, Timeout),
try
Fun(Worker)
after
Please sign in to comment.
Something went wrong with that request. Please try again.