Skip to content
This repository

Fix backwards compatability with old start_link/2 #16

Merged
merged 1 commit into from over 1 year ago

3 participants

Andrew Thompson Don't Add Me To Your Organization a.k.a The Travis Bot Devin Torres
Andrew Thompson
Collaborator

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

Also, fix some whitespace screwups.

Don't Add Me To Your Organization a.k.a The Travis Bot

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

Andrew Thompson 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
Devin Torres
Owner

It seems a test failed?

Andrew Thompson
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.

Devin Torres devinus merged commit 5d23ce5 into from September 04, 2012
Devin Torres devinus closed this September 04, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Sep 04, 2012
Andrew Thompson 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
This page is out of date. Refresh to see the latest.

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

  1. 15  src/poolboy.erl
15  src/poolboy.erl
@@ -5,7 +5,7 @@
5 5
 
6 6
 -export([checkout/1, checkout/2, checkout/3, checkin/2, transaction/2,
7 7
          child_spec/2, child_spec/3, start/1, start/2, start_link/1,
8  
-		 start_link/2, stop/1, status/1]).
  8
+         start_link/2, stop/1, status/1]).
9 9
 -export([init/1, ready/2, ready/3, overflow/2, overflow/3, full/2, full/3,
10 10
          handle_event/3, handle_sync_event/4, handle_info/3, terminate/3,
11 11
          code_change/4]).
@@ -63,20 +63,21 @@ child_spec(Pool, PoolArgs, WorkerArgs) ->
63 63
      permanent, 5000, worker, [poolboy]}.
64 64
 
65 65
 -spec start(PoolArgs :: proplists:proplist())
66  
-	-> {ok, pid()}.
  66
+    -> {ok, pid()}.
67 67
 start(PoolArgs) ->
68  
-	start(PoolArgs, []).
  68
+    start(PoolArgs, []).
69 69
 
70 70
 -spec start(PoolArgs :: proplists:proplist(),
71  
-			WorkerArgs:: proplists:proplist())
  71
+            WorkerArgs:: proplists:proplist())
72 72
     -> {ok, pid()}.
73 73
 start(PoolArgs, WorkerArgs) ->
74  
-	start_pool(start, PoolArgs, WorkerArgs).
  74
+    start_pool(start, PoolArgs, WorkerArgs).
75 75
 
76 76
 -spec start_link(PoolArgs :: proplists:proplist())
77 77
     -> {ok, pid()}.
78 78
 start_link(PoolArgs)  ->
79  
-    start_link(PoolArgs, []).
  79
+    %% for backwards compatability, pass the pool args as the worker args as well
  80
+    start_link(PoolArgs, PoolArgs).
80 81
 
81 82
 -spec start_link(PoolArgs :: proplists:proplist(),
82 83
                  WorkerArgs:: proplists:proplist())
@@ -106,7 +107,7 @@ init([{size, Size} | Rest], WorkerArgs, State) when is_integer(Size) ->
106 107
 init([{max_overflow, MaxOverflow} | Rest], WorkerArgs, State) when is_integer(MaxOverflow) ->
107 108
     init(Rest, WorkerArgs, State#state{max_overflow=MaxOverflow});
108 109
 init([_ | Rest], WorkerArgs, State) ->
109  
-	init(Rest, WorkerArgs, State);
  110
+    init(Rest, WorkerArgs, State);
110 111
 init([], _WorkerArgs, #state{size=Size, supervisor=Sup, max_overflow=MaxOverflow}=State) ->
111 112
     Workers = prepopulate(Size, Sup),
112 113
     StartState = case Size of
Commit_comment_tip

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.