You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2015/07/22 23:01:26 UTC
[5/7] chttpd commit: updated refs/heads/2724-chunked-buffering to
45bb534
Execute a callback for every complete DB traversal
This ensures that we don't enter a receive statement waiting for new DB
updates without first flushing the buffer.
COUCHDB-2724
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/cf720aa1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/cf720aa1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/cf720aa1
Branch: refs/heads/2724-chunked-buffering
Commit: cf720aa13a0cf23147d85f0c7a7c9d800d151c5f
Parents: b926134
Author: Adam Kocoloski <ad...@cloudant.com>
Authored: Wed Jun 24 13:56:18 2015 -0400
Committer: Adam Kocoloski <ad...@cloudant.com>
Committed: Wed Jul 22 16:57:49 2015 -0400
----------------------------------------------------------------------
src/chttpd_db.erl | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/cf720aa1/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 27e1795..d8327b1 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -201,6 +201,10 @@ changes_callback({stop, EndSeq, Pending}, Acc) ->
end,
chttpd:end_delayed_json_response(Resp1);
+changes_callback(waiting_for_updates, Acc) ->
+ #cacc{buffer = Buf, mochi = Resp} = Acc,
+ {ok, Resp1} = chttpd:send_delayed_chunk(Resp, Buf),
+ {ok, Acc#cacc{buffer = [], bufsize = 0, mochi = Resp1}};
changes_callback(timeout, Acc) ->
{ok, Resp1} = chttpd:send_delayed_chunk(Acc#cacc.mochi, "\n"),
{ok, Acc#cacc{mochi = Resp1}};