Slight style tweaks to rexi_buffer hibernation Avoid using a possibly misleading variable name by not naming it. Alternatively, this is not the variable name you are looking for.
BugzId: 27672 Project: http://git-wip-us.apache.org/repos/asf/couchdb-rexi/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-rexi/commit/23cda378 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-rexi/tree/23cda378 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-rexi/diff/23cda378 Branch: refs/heads/windsor-merge Commit: 23cda378322851e8d09c850510ed75119cc83adf Parents: e13e16f Author: Paul J. Davis <[email protected]> Authored: Fri Jan 31 02:55:57 2014 -0600 Committer: Robert Newson <[email protected]> Committed: Wed Jul 23 18:06:43 2014 +0100 ---------------------------------------------------------------------- src/rexi_buffer.erl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-rexi/blob/23cda378/src/rexi_buffer.erl ---------------------------------------------------------------------- diff --git a/src/rexi_buffer.erl b/src/rexi_buffer.erl index 880e4dd..874ec3c 100644 --- a/src/rexi_buffer.erl +++ b/src/rexi_buffer.erl @@ -72,16 +72,17 @@ handle_info(timeout, #state{sender = nil} = State) -> if Sender =:= nil, C > 1 -> {noreply, State#state{buffer = Q2, count = C-1}, 0}; true -> + NewState = State#state{buffer = Q2, sender = Sender, count = C-1}, % When Sender is nil and C-1 == 0 we're reverting to an % idle state with no outstanding or queued messages. We'll % use this oppurtunity to hibernate this process and % run a garbage collection. - Timeout = case {Sender, C-1} of - {nil, 0} -> hibernate; - _ -> infinity - end, - NewState = State#state{buffer = Q2, sender = Sender, count = C-1}, - {noreply, NewState, Timeout} + case {Sender, C-1} of + {nil, 0} -> + {noreply, NewState, hibernate}; + _ -> + {noreply, NewState, infinity} + end end; handle_info(timeout, State) -> % Waiting on a sender to return
