diff options
author | Adam Kocoloski <kocolosk@apache.org> | 2022-02-24 10:36:38 -0500 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2022-05-18 14:02:53 -0400 |
commit | d179196f3ee9e31d9325a404e8e6ba5fa6e24b22 (patch) | |
tree | d82c0b2f919c01b2c70bbb9ea13cc327120f8503 | |
parent | 8601e40f624bf9b7f0c067073ca13040c8026978 (diff) | |
download | couchdb-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.erl | 9 |
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 |