nickva commented on a change in pull request #3940:
URL: https://github.com/apache/couchdb/pull/3940#discussion_r814356307
##########
File path: src/couch/src/couch_httpd_multipart.erl
##########
@@ -134,6 +138,10 @@ mp_abort_parse_atts(_, _) ->
maybe_send_data({Ref, Chunks, Offset, Counters, Waiting}) ->
receive
+ {hello_from_writer, Ref, WriterPid} ->
+ WriterRef = erlang:monitor(process, WriterPid),
+ NewCounters = orddict:store(WriterPid, {WriterRef, 0}, Counters),
Review comment:
Yeah, agree. It seems we'd want to initialize each separate follows
parser only once. Then I think it could work?
So, for example, we could fold over all docs [1] and all the attachments and
keep a map of `#{ParserPid => Ref}` in the accumulator (slightly nicer than a
process dict!).
- If the `ParserPid` is not in the map:
* Start monitoring it
* Send the `{hello_from_writer, Ref, WriterPid}`
* Add it to the map
* Use its `Ref` in the `receive` `DOWN'` inside the closure
- If, `ParserPid` is in the map:
* Skip sending the `hello` message
* And just use its existing `Ref` value in the `receive DOWN'` in the
closure.
[1] It's seems it's not just a doc with multiple attachment but it could
also be multiple docs, each with multiple attachments?
--
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]