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


##########
src/couch_replicator/src/couch_replicator_docs.erl:
##########
@@ -226,6 +248,31 @@ save_rep_doc(DbName, Doc) ->
         couch_db:close(Db)
     end.
 
+defer_call(Fun) ->
+    {Pid, Ref} = spawn_monitor(fun() ->
+        try Fun() of
+            Resp ->
+                exit({exit_ok, Resp})
+        catch
+            throw:Reason ->
+                exit({exit_throw, Reason});
+            error:Reason ->
+                exit({exit_error, Reason});
+            exit:Reason ->
+                exit({exit_exit, Reason})
+        end
+    end),
+    receive
+        {'DOWN', Ref, process, Pid, {exit_ok, Ret}} ->
+            Ret;
+        {'DOWN', Ref, process, Pid, {exit_throw, Reason}} ->
+            throw(Reason);
+        {'DOWN', Ref, process_, Pid, {exit_error, Reason}} ->
+            error(Reason);
+        {'DOWN', Ref, process, Pid, {exit_exit, Reason}} ->
+            exit(Reason)

Review Comment:
   We have to be careful here. Any errors like timeout, cluster internal errors 
etc might kill the multdb changes feed and kill the replicator app



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