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/20 23:09:03 UTC

couch-mrview commit: updated refs/heads/2724-chunked-buffering to bf495c9

Repository: couchdb-couch-mrview
Updated Branches:
  refs/heads/2724-chunked-buffering 2f489b9cd -> bf495c9a1


Guard against flushing an empty buffer

If the threshold is set below the size of an individual row we
effectively disable buffering. In that case we need to make sure not to
try and flush an empty buffer, as that's exactly the syntax for
terminating a chunked response.


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

Branch: refs/heads/2724-chunked-buffering
Commit: bf495c9a1dd681cba6d7a0eea814151213b9381b
Parents: 2f489b9
Author: Adam Kocoloski <ad...@cloudant.com>
Authored: Mon Jul 20 17:08:02 2015 -0400
Committer: Adam Kocoloski <ad...@cloudant.com>
Committed: Mon Jul 20 17:08:02 2015 -0400

----------------------------------------------------------------------
 src/couch_mrview_http.erl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/bf495c9a/src/couch_mrview_http.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_http.erl b/src/couch_mrview_http.erl
index d7aff3b..d04ee94 100644
--- a/src/couch_mrview_http.erl
+++ b/src/couch_mrview_http.erl
@@ -375,7 +375,7 @@ view_cb({error, Reason}, #vacc{resp=Resp}=Acc) ->
     {ok, Acc#vacc{resp=Resp1}}.
 
 maybe_flush_response(#vacc{bufsize=Size, threshold=Max} = Acc, Data, Len)
-        when (Size + Len) > Max ->
+        when Size > 0 andalso (Size + Len) > Max ->
     #vacc{buffer = Buffer, resp = Resp} = Acc,
     {ok, R1} = chttpd:send_delayed_chunk(Resp, Buffer),
     {ok, Acc#vacc{prepend = ",\r\n", buffer = Data, bufsize = Len, resp = R1}};