Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix backwards compatability with old start_link/2 #16

Merged
merged 1 commit into from

3 participants

@Vagabond
Collaborator

If the old API is used, pass PoolArgs as WorkerArgs so that legacy code doesn't break.

Also, fix some whitespace screwups.

@travisbot

This pull request fails (merged 87ce1a8 into c8f3f83).

@Vagabond Vagabond Fix backwards compatability with old start_link/2
If the old API is used, pass PoolArgs as WorkerArgs so that legacy code
doesn't break.

Also, fix some whitespace screwups.
87ce1a8
@devinus
Owner

It seems a test failed?

@Vagabond
Collaborator

As far as I can tell, that test will randomly timeout on Travis for some reason. I had it to do it to me on another branch the other day.

@devinus devinus merged commit 5d23ce5 into master

1 check failed

Details default The Travis build failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 4, 2012
  1. @Vagabond

    Fix backwards compatability with old start_link/2

    Vagabond authored
    If the old API is used, pass PoolArgs as WorkerArgs so that legacy code
    doesn't break.
    
    Also, fix some whitespace screwups.
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 7 deletions.
  1. +8 −7 src/poolboy.erl
View
15 src/poolboy.erl
@@ -5,7 +5,7 @@
-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]).
+ start_link/2, stop/1, status/1]).
-export([init/1, ready/2, ready/3, overflow/2, overflow/3, full/2, full/3,
handle_event/3, handle_sync_event/4, handle_info/3, terminate/3,
code_change/4]).
@@ -63,20 +63,21 @@ child_spec(Pool, PoolArgs, WorkerArgs) ->
permanent, 5000, worker, [poolboy]}.
-spec start(PoolArgs :: proplists:proplist())
- -> {ok, pid()}.
+ -> {ok, pid()}.
start(PoolArgs) ->
- start(PoolArgs, []).
+ start(PoolArgs, []).
-spec start(PoolArgs :: proplists:proplist(),
- WorkerArgs:: proplists:proplist())
+ WorkerArgs:: proplists:proplist())
-> {ok, pid()}.
start(PoolArgs, WorkerArgs) ->
- start_pool(start, PoolArgs, WorkerArgs).
+ start_pool(start, PoolArgs, WorkerArgs).
-spec start_link(PoolArgs :: proplists:proplist())
-> {ok, pid()}.
start_link(PoolArgs) ->
- start_link(PoolArgs, []).
+ %% for backwards compatability, pass the pool args as the worker args as well
+ start_link(PoolArgs, PoolArgs).
-spec start_link(PoolArgs :: proplists:proplist(),
WorkerArgs:: proplists:proplist())
@@ -106,7 +107,7 @@ init([{size, Size} | Rest], WorkerArgs, State) when is_integer(Size) ->
init([{max_overflow, MaxOverflow} | Rest], WorkerArgs, State) when is_integer(MaxOverflow) ->
init(Rest, WorkerArgs, State#state{max_overflow=MaxOverflow});
init([_ | Rest], WorkerArgs, State) ->
- init(Rest, WorkerArgs, State);
+ init(Rest, WorkerArgs, State);
init([], _WorkerArgs, #state{size=Size, supervisor=Sup, max_overflow=MaxOverflow}=State) ->
Workers = prepopulate(Size, Sup),
StartState = case Size of
Something went wrong with that request. Please try again.