aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Lasseter <nathan.je.lasseter@googlemail.com>2011-01-28 22:44:46 +0000
committerNathan Lasseter <nathan.je.lasseter@googlemail.com>2011-01-28 22:44:46 +0000
commit76d97f8eb464f345da43abb6403b582079d4fb23 (patch)
tree15e9503b125be970a6072ce84b6c782bea8996e8
parent613e8778e9f6a1107d7563a60574f557a71c6e4c (diff)
stop_bal no longer kills servers
-rw-r--r--README.textile2
-rw-r--r--TODO.textile2
-rw-r--r--erlbal.erl2
-rw-r--r--erlbal_tests.erl4
4 files changed, 6 insertions, 4 deletions
diff --git a/README.textile b/README.textile
index 8af6e41..8f26fcf 100644
--- a/README.textile
+++ b/README.textile
@@ -5,7 +5,7 @@ erlbal is an erlang load balancer.
h2. Balancer calls:
* start_bal/0 spawns a balancer.
-* stop_bal/1 takes a balancer and kills all of its servers and then kills the balancer.
+* stop_bal/1 takes a balancer kills the balancer.
* list_servers/1 takes a balancer and returns a list of the servers it balances over.
h2. Server calls:
diff --git a/TODO.textile b/TODO.textile
index bf95e49..fa5598e 100644
--- a/TODO.textile
+++ b/TODO.textile
@@ -2,8 +2,6 @@ h1. TODO
h2. Little changes:
-* Add server state
-* stop_bal/1 should not kill servers
h2. BIG changes:
diff --git a/erlbal.erl b/erlbal.erl
index e03d5e1..a8b8713 100644
--- a/erlbal.erl
+++ b/erlbal.erl
@@ -50,7 +50,7 @@ bal_loop(Serverlist, Nextserver) ->
bal_loop(Serverlist, NS)
end;
die ->
- lists:foreach(fun(X) -> X ! die end, Serverlist)
+ ok
end.
diff --git a/erlbal_tests.erl b/erlbal_tests.erl
index cee35fc..961ba08 100644
--- a/erlbal_tests.erl
+++ b/erlbal_tests.erl
@@ -7,6 +7,7 @@ start(simple) ->
erlbal:start_server(Bal, node(), fun(_, _) -> {8, []} end, []),
7 = erlbal:make_request(Bal, []),
8 = erlbal:make_request(Bal, []),
+ lists:foreach(fun(X) -> erlbal:stop_server(Bal, X) end, erlbal:list_servers(Bal)),
erlbal:stop_bal(Bal),
ok;
@@ -16,6 +17,7 @@ start(args) ->
erlbal:start_server(Bal, node(), fun([X], _) -> {X+2, []} end, []),
7 = erlbal:make_request(Bal, [6]),
8 = erlbal:make_request(Bal, [6]),
+ lists:foreach(fun(X) -> erlbal:stop_server(Bal, X) end, erlbal:list_servers(Bal)),
erlbal:stop_bal(Bal),
ok;
@@ -25,6 +27,7 @@ start(state) ->
erlbal:start_server(Bal, node(), fun([X], [S]) -> Y = X + S, {Y, [S]} end, [10]),
7 = erlbal:make_request(Bal, [6]),
16 = erlbal:make_request(Bal, [6]),
+ lists:foreach(fun(X) -> erlbal:stop_server(Bal, X) end, erlbal:list_servers(Bal)),
erlbal:stop_bal(Bal),
ok;
@@ -36,5 +39,6 @@ start(complex_state) ->
16 = erlbal:make_request(Bal, [6]),
8 = erlbal:make_request(Bal, [6]),
17 = erlbal:make_request(Bal, [6]),
+ lists:foreach(fun(X) -> erlbal:stop_server(Bal, X) end, erlbal:list_servers(Bal)),
erlbal:stop_bal(Bal),
ok.