You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/01/18 01:47:30 UTC

[05/50] git commit: Eliminate a list traversal on handling 'DOWN' message

Eliminate a list traversal on handling 'DOWN' message


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/78ca542b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/78ca542b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/78ca542b

Branch: refs/heads/import
Commit: 78ca542bf33229c65e644b56625421024cd5abc8
Parents: 5af2b89
Author: Adam Kocoloski <ad...@cloudant.com>
Authored: Mon Apr 23 12:59:19 2012 -0400
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Fri Jan 17 16:44:29 2014 -0800

----------------------------------------------------------------------
 src/couch_stats_collector.erl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/78ca542b/src/couch_stats_collector.erl
----------------------------------------------------------------------
diff --git a/src/couch_stats_collector.erl b/src/couch_stats_collector.erl
index 8a4d9eb..0ebca99 100644
--- a/src/couch_stats_collector.erl
+++ b/src/couch_stats_collector.erl
@@ -105,9 +105,9 @@ handle_cast({track_process_count, Pid, Stat}, State) ->
     {noreply, [{Ref, Stat} | State]}.
 
 handle_info({'DOWN', Ref, _, _, _}, State) ->
-    {Ref, Stat} = lists:keyfind(Ref, 1, State),
+    {value, {Ref, Stat}, NewState} = lists:keytake(Ref, 1, State),
     ok = couch_stats_collector:decrement(Stat),
-    {noreply, lists:keydelete(Ref, 1, State)}.
+    {noreply, NewState}.
 
 code_change(_OldVersion, State, _Extra) ->
     {ok, State}.