You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/30 12:52:48 UTC
chttpd commit: updated refs/heads/master to 4b01dea
Repository: couchdb-chttpd
Updated Branches:
refs/heads/master 4fd6ca1e5 -> 4b01dea85
Decrement clients_requesting_changes in a timely fashion
The previous approach using process_tracker was flawed. If a client
reuses a connection, as is common, the clients_requesting_changes
metric will only be decremented when the connection is terminated,
even if the connection is not requesting changes.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/4b01dea8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/4b01dea8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/4b01dea8
Branch: refs/heads/master
Commit: 4b01dea85ca8d79aa9377bfb45dc1f88e7253474
Parents: 4fd6ca1
Author: Robert Newson <rn...@apache.org>
Authored: Sat Aug 30 11:52:24 2014 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Sat Aug 30 11:52:24 2014 +0100
----------------------------------------------------------------------
src/chttpd_db.erl | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/4b01dea8/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 84f973e..b6ed459 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -73,8 +73,12 @@ handle_changes_req(#httpd{method='GET'}=Req, Db) ->
ChangesArgs)
end);
Feed when Feed =:= "continuous"; Feed =:= "longpoll"; Feed =:= "eventsource" ->
- couch_stats_process_tracker:track([chttpd, clients_requesting_changes]),
- fabric:changes(Db, fun changes_callback/2, {Feed, Req}, ChangesArgs);
+ couch_stats:increment_counter([chttpd, clients_requesting_changes]),
+ try
+ fabric:changes(Db, fun changes_callback/2, {Feed, Req}, ChangesArgs)
+ after
+ couch_stats:decrement_counter([chttpd, clients_requesting_changes])
+ end;
_ ->
Msg = <<"Supported `feed` types: normal, continuous, longpoll, eventsource">>,
throw({bad_request, Msg})