nickva commented on code in PR #6013:
URL: https://github.com/apache/couchdb/pull/6013#discussion_r3730486227


##########
src/couch_replicator/src/couch_replicator_api_wrap.erl:
##########
@@ -500,17 +505,24 @@ update_docs(#httpdb{} = HttpDb, DocList, Options, 
UpdateType) ->
         ([Doc | RestDocs]) ->
             {ok, [Doc, ","], RestDocs}
     end,
-    Headers = [
-        {"Content-Length", Len},
+    Headers0 = [
         {"Content-Type", "application/json"},
         {"X-Couch-Full-Commit", FullCommit}
     ],
+    {Body, Headers} =
+        case should_compress_request(HttpDb, Len) of
+            true ->
+                FullBody = iolist_to_binary([Prefix, lists:join(",", Docs), 
Suffix]),

Review Comment:
   Good catch by @rnewson that zlib:gzip takes iolists that means we don't have 
have to create a binary here. The FullBody could just be `[Prefix, 
lists:join(",", Docs), Suffix]` just check that we don't do byte_size or 
is_binary calls on the result
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to