kocolosk commented on a change in pull request #3940:
URL: https://github.com/apache/couchdb/pull/3940#discussion_r814329743



##########
File path: src/fabric/src/fabric_rpc.erl
##########
@@ -638,16 +638,14 @@ make_att_readers([#doc{atts = Atts0} = Doc | Rest]) ->
     [Doc#doc{atts = Atts} | make_att_readers(Rest)].
 
 make_att_reader({follows, Parser, Ref}) ->
+    % This code will fail if the returned closure is called by a
+    % process other than the one that called make_att_reader/1 in the
+    % first place. The reason we don't put everything inside the
+    % closure is that the `hello_from_writer` message must *always* be
+    % sent to the parser, even if the closure never gets called.
+    ParserRef = erlang:monitor(process, Parser),
+    Parser ! {hello_from_writer, Ref, self()},

Review comment:
       Ah, I totally missed the 1 parser + multiple attachments line of 
thinking. I was looking at the caching and figuring it was only there because 
the function was being invoked for every `get_bytes` call, but yes, what you're 
proposing definitely makes sense given the lifecycle of the parser. Thanks for 
pointing it out!
   
   And yes, it makes sense to extend the test suite here.




-- 
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