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 | f318a056c0c6999fe5d9d853440f4a49e92530b3 (patch) | |
| tree | a0fea827dd7cabb7318ec96fefdacf952130b0bc | |
| parent | 036343b0ef74c0db648ae19afd4649171b1db27f (diff) | |
| download | rabbitmq-server-git-f318a056c0c6999fe5d9d853440f4a49e92530b3.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 b883d4f0cb..1ee958afb6 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 fc3ce3714f..3bfcc2d9ff 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}. |
