diff options
author | Matthew Sackman <matthew@lshift.net> | 2010-04-04 04:00:48 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@lshift.net> | 2010-04-04 04:00:48 +0100 |
commit | 15d76638c881fb470e72ea900c0cad56638269e2 (patch) | |
tree | a0fea827dd7cabb7318ec96fefdacf952130b0bc | |
parent | 48f0a3c9dd6b6d86009db225014db891f54954a6 (diff) | |
download | rabbitmq-server-15d76638c881fb470e72ea900c0cad56638269e2.tar.gz |
Missing hibernate timeout
-rw-r--r-- | src/worker_pool.erl | 8 | ||||
-rw-r--r-- | src/worker_pool_worker.erl | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/worker_pool.erl b/src/worker_pool.erl index b883d4f0..1ee958af 100644 --- a/src/worker_pool.erl +++ b/src/worker_pool.erl @@ -93,9 +93,11 @@ handle_call(next_free, From, State = #state { available = Avail, pending = Pending }) -> case queue:out(Avail) of {empty, _Avail} -> - {noreply, State #state { pending = queue:in(From, Pending) }}; + {noreply, State #state { pending = queue:in(From, Pending) }, + hibernate}; {{value, WId}, Avail1} -> - {reply, get_worker_pid(WId), State #state { available = Avail1 }} + {reply, get_worker_pid(WId), State #state { available = Avail1 }, + hibernate} end; handle_call(Msg, _From, State) -> @@ -109,7 +111,7 @@ handle_cast({idle, WId}, State = #state { available = Avail, {{value, From}, Pending1} -> gen_server2:reply(From, get_worker_pid(WId)), State #state { pending = Pending1 } - end}; + end, hibernate}; handle_cast(Msg, State) -> {stop, {unexpected_cast, Msg}, State}. diff --git a/src/worker_pool_worker.erl b/src/worker_pool_worker.erl index fc3ce371..3bfcc2d9 100644 --- a/src/worker_pool_worker.erl +++ b/src/worker_pool_worker.erl @@ -69,7 +69,7 @@ init([WId]) -> handle_call({submit, Fun}, From, WId) -> gen_server2:reply(From, run(Fun)), ok = worker_pool:idle(WId), - {noreply, WId}; + {noreply, WId, hibernate}; handle_call(Msg, _From, State) -> {stop, {unexpected_call, Msg}, State}. |