summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2022-02-24 10:36:38 -0500
committerNick Vatamaniuc <nickva@users.noreply.github.com>2022-05-18 14:02:53 -0400
commitd179196f3ee9e31d9325a404e8e6ba5fa6e24b22 (patch)
treed82c0b2f919c01b2c70bbb9ea13cc327120f8503
parent8601e40f624bf9b7f0c067073ca13040c8026978 (diff)
downloadcouchdb-d179196f3ee9e31d9325a404e8e6ba5fa6e24b22.tar.gz
Preserve support for single-node couch_httpd path
The `hello_from_writer` message is only used in fabric, while we still have unit tests that go through the couch_httpd side of things. We can afford to be defensive here.
-rw-r--r--src/couch/src/couch_httpd_multipart.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/couch/src/couch_httpd_multipart.erl b/src/couch/src/couch_httpd_multipart.erl
index b397502c0..ba1c79315 100644
--- a/src/couch/src/couch_httpd_multipart.erl
+++ b/src/couch/src/couch_httpd_multipart.erl
@@ -217,8 +217,13 @@ maybe_send_data({Ref, Chunks, Offset, Counters, Waiting}) ->
end.
update_writer(WriterPid, Counters) ->
- UpdateFun = fun({WriterRef, Count}) -> {WriterRef, Count + 1} end,
- orddict:update(WriterPid, UpdateFun, Counters).
+ case orddict:find(WriterPid, Counters) of
+ {ok, {WriterRef, Count}} ->
+ orddict:store(WriterPid, {WriterRef, Count + 1}, Counters);
+ error ->
+ WriterRef = erlang:monitor(process, WriterPid),
+ orddict:store(WriterPid, {WriterRef, 1}, Counters)
+ end.
remove_writer(WriterPid, WriterRef, Counters) ->
case orddict:find(WriterPid, Counters) of