Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

poolboy:transaction/3 Timeout support #17

Merged
merged 2 commits into from over 1 year ago

3 participants

lefan Artem Teslenko Devin Torres
lefan

Hello,

There is a commit to add Timeout support for poolboy:transaction

thanks

Artem Teslenko

+1 Please merge

Devin Torres
Owner

Yes, this was an oversight for sure. Will merge today.

Devin Torres devinus merged commit 02eb91a into from
Devin Torres
Owner

Gah, I merged this on accident. I'll pull from your branch myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Sep 28, 2012
lefan lefan Added Timeout for poolboy:transaction a50e24e
Jan 17, 2013
lefan lefan Merge remote-tracking branch 'mainstream/master'
Conflicts:
	src/poolboy.erl
68842b3
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 8 additions and 3 deletions. Show diff stats Hide diff stats

  1. +8 3 src/poolboy.erl
11 src/poolboy.erl
@@ -4,8 +4,8 @@
4 4 -behaviour(gen_server).
5 5
6 6 -export([checkout/1, checkout/2, checkout/3, checkin/2, transaction/2,
7   - child_spec/2, child_spec/3, start/1, start/2, start_link/1,
8   - start_link/2, stop/1, status/1]).
  7 + transaction/3, child_spec/2, child_spec/3, start/1, start/2,
  8 + start_link/1, start_link/2, stop/1, status/1]).
9 9 -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
10 10 code_change/3]).
11 11
@@ -41,7 +41,12 @@ checkin(Pool, Worker) when is_pid(Worker) ->
41 41 -spec transaction(Pool :: node(), Fun :: fun((Worker :: pid()) -> any()))
42 42 -> any().
43 43 transaction(Pool, Fun) ->
44   - Worker = poolboy:checkout(Pool),
  44 + transaction(Pool, Fun, ?TIMEOUT).
  45 +
  46 +-spec transaction(Pool :: node(), Fun :: fun((Worker :: pid()) -> any()),
  47 + Timeout :: timeout()) -> any().
  48 +transaction(Pool, Fun, Timeout) ->
  49 + Worker = poolboy:checkout(Pool, true, Timeout),
45 50 try
46 51 Fun(Worker)
47 52 after

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.