This is an automated email from the ASF dual-hosted git repository.

iilyak pushed a commit to branch retry-on-noproc-errors-2
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 7785054a2004c3673922ca72f7b7bd6c11ed6d48
Author: ILYA Khlopotov <[email protected]>
AuthorDate: Thu Sep 11 11:46:37 2025 -0700

    Factor out the index_call fun (remove old clauses)
---
 src/dreyfus/src/dreyfus_rpc.erl | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/src/dreyfus/src/dreyfus_rpc.erl b/src/dreyfus/src/dreyfus_rpc.erl
index 2ebc5ffe5..ca6c74220 100644
--- a/src/dreyfus/src/dreyfus_rpc.erl
+++ b/src/dreyfus/src/dreyfus_rpc.erl
@@ -48,20 +48,7 @@ call(Fun, DbName, DDoc, IndexName, QueryArgs0) ->
         {ok, Index} ->
             case dreyfus_index_manager:get_index(DbName, Index) of
                 {ok, Pid} ->
-                    case dreyfus_index:await(Pid, MinSeq) of
-                        {ok, IndexPid, _Seq} ->
-                            Result = dreyfus_index:Fun(IndexPid, QueryArgs),
-                            rexi:reply(Result);
-                        % obsolete clauses, remove after upgrade
-                        ok ->
-                            Result = dreyfus_index:Fun(Pid, QueryArgs),
-                            rexi:reply(Result);
-                        {ok, _Seq} ->
-                            Result = dreyfus_index:Fun(Pid, QueryArgs),
-                            rexi:reply(Result);
-                        Error ->
-                            rexi:reply(Error)
-                    end;
+                    rexi:reply(index_call(Fun, Pid, MinSeq, QueryArgs));
                 Error ->
                     rexi:reply(Error)
             end;
@@ -69,6 +56,14 @@ call(Fun, DbName, DDoc, IndexName, QueryArgs0) ->
             rexi:reply(Error)
     end.
 
+index_call(Fun, Pid, MinSeq, QueryArgs) ->
+    case dreyfus_index:await(Pid, MinSeq) of
+        {ok, IndexPid, _Seq} ->
+            dreyfus_index:Fun(IndexPid, QueryArgs);
+        Error ->
+            Error
+    end.
+
 info(DbName, DDoc, IndexName) ->
     MFA = {?MODULE, info_int, [DbName, DDoc, IndexName]},
     dreyfus_util:time([rpc, info], MFA).

Reply via email to