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

jiahuili430 pushed a commit to branch fix-compilation-warnings
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit afcf7b24eb8e01dee2f428f2b7dc12a5ddd5e4aa
Author: Jiahui Li <[email protected]>
AuthorDate: Wed Sep 17 11:04:31 2025 -0500

    Replace `gen_server:format_status/2` to `format_status/1`
    
    Fix the following warnings:
    
    ```log
    Warning: the callback gen_server:format_status(_,_) is deprecated; use 
format_status/1 instead
    ```
---
 src/couch/src/couch_file.erl                                | 4 ++--
 src/couch_replicator/src/couch_replicator_auth_session.erl  | 4 ++--
 src/couch_replicator/src/couch_replicator_httpc_pool.erl    | 6 +++---
 src/couch_replicator/src/couch_replicator_scheduler.erl     | 4 ++--
 src/couch_replicator/src/couch_replicator_scheduler_job.erl | 6 +++---
 src/couch_replicator/src/couch_replicator_worker.erl        | 6 +++---
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/couch/src/couch_file.erl b/src/couch/src/couch_file.erl
index 9efc7978e..c2f161a69 100644
--- a/src/couch/src/couch_file.erl
+++ b/src/couch/src/couch_file.erl
@@ -51,7 +51,7 @@
 -export([delete/2, delete/3, nuke_dir/2, init_delete_dir/1]).
 
 % gen_server callbacks
--export([init/1, terminate/2, format_status/2]).
+-export([init/1, terminate/2, format_status/1]).
 -export([handle_call/3, handle_cast/2, handle_info/2]).
 
 %% helper functions
@@ -621,7 +621,7 @@ handle_info({'DOWN', Ref, process, _Pid, _Info}, 
#file{db_monitor = Ref} = File)
         false -> {noreply, File}
     end.
 
-format_status(_Opt, [PDict, #file{} = File]) ->
+format_status([PDict, #file{} = File]) ->
     {_Fd, FilePath} = couch_util:get_value(couch_file_fd, PDict),
     [{data, [{"State", File}, {"InitialFilePath", FilePath}]}].
 
diff --git a/src/couch_replicator/src/couch_replicator_auth_session.erl 
b/src/couch_replicator/src/couch_replicator_auth_session.erl
index 8f0be0a1d..3112c8b6f 100644
--- a/src/couch_replicator/src/couch_replicator_auth_session.erl
+++ b/src/couch_replicator/src/couch_replicator_auth_session.erl
@@ -62,7 +62,7 @@
     handle_call/3,
     handle_cast/2,
     handle_info/2,
-    format_status/2
+    format_status/1
 ]).
 
 -include_lib("ibrowse/include/ibrowse.hrl").
@@ -154,7 +154,7 @@ handle_info(Msg, State) ->
     couch_log:error("~p : Received un-expected message ~p", [?MODULE, Msg]),
     {noreply, State}.
 
-format_status(_Opt, [_PDict, State]) ->
+format_status([_PDict, State]) ->
     [
         {epoch, State#state.epoch},
         {user, State#state.user},
diff --git a/src/couch_replicator/src/couch_replicator_httpc_pool.erl 
b/src/couch_replicator/src/couch_replicator_httpc_pool.erl
index fb15dcea1..0124b3dc7 100644
--- a/src/couch_replicator/src/couch_replicator_httpc_pool.erl
+++ b/src/couch_replicator/src/couch_replicator_httpc_pool.erl
@@ -19,7 +19,7 @@
 
 % gen_server API
 -export([init/1, handle_call/3, handle_info/2, handle_cast/2]).
--export([format_status/2]).
+-export([format_status/1]).
 
 -include_lib("couch/include/couch_db.hrl").
 
@@ -135,7 +135,7 @@ handle_info({'DOWN', Ref, process, _, _}, #state{callers = 
Callers} = State) ->
             {noreply, State}
     end.
 
-format_status(_Opt, [_PDict, State]) ->
+format_status([_PDict, State]) ->
     #state{
         url = Url,
         proxy_url = ProxyUrl
@@ -200,7 +200,7 @@ format_status_test_() ->
             url = "https://username1:password1@$ACCOUNT2.cloudant.com/db";,
             proxy_url = "https://username2:[email protected]:8080/";
         },
-        [{data, [{"State", ScrubbedN}]}] = format_status(normal, [[], State]),
+        [{data, [{"State", ScrubbedN}]}] = format_status([[], State]),
         ?assertEqual("https://username1:*****@$ACCOUNT2.cloudant.com/db";, 
ScrubbedN#state.url),
         ?assertEqual("https://username2:*****@proxy.thing.com:8080/";, 
ScrubbedN#state.proxy_url),
         ok
diff --git a/src/couch_replicator/src/couch_replicator_scheduler.erl 
b/src/couch_replicator/src/couch_replicator_scheduler.erl
index 379a42b38..0af64e291 100644
--- a/src/couch_replicator/src/couch_replicator_scheduler.erl
+++ b/src/couch_replicator/src/couch_replicator_scheduler.erl
@@ -25,7 +25,7 @@
     handle_call/3,
     handle_info/2,
     handle_cast/2,
-    format_status/2
+    format_status/1
 ]).
 
 -export([
@@ -357,7 +357,7 @@ terminate(_Reason, _State) ->
     couch_replicator_share:clear(),
     ok.
 
-format_status(_Opt, [_PDict, State]) ->
+format_status([_PDict, State]) ->
     [
         {max_jobs, State#state.max_jobs},
         {running_jobs, running_job_count()},
diff --git a/src/couch_replicator/src/couch_replicator_scheduler_job.erl 
b/src/couch_replicator/src/couch_replicator_scheduler_job.erl
index 7f123441f..5e1bbc175 100644
--- a/src/couch_replicator/src/couch_replicator_scheduler_job.erl
+++ b/src/couch_replicator/src/couch_replicator_scheduler_job.erl
@@ -25,7 +25,7 @@
     handle_call/3,
     handle_info/2,
     handle_cast/2,
-    format_status/2,
+    format_status/1,
     sum_stats/2,
     report_seq_done/3
 ]).
@@ -477,7 +477,7 @@ terminate_cleanup(#rep_state{rep_details = #rep{id = 
RepId}} = State) ->
     couch_replicator_api_wrap:db_close(State#rep_state.source),
     couch_replicator_api_wrap:db_close(State#rep_state.target).
 
-format_status(_Opt, [_PDict, State]) ->
+format_status([_PDict, State]) ->
     #rep_state{
         source = Source,
         target = Target,
@@ -1241,7 +1241,7 @@ t_scheduler_job_format_status(_) ->
         current_through_seq = <<"4">>,
         highest_seq_done = <<"5">>
     },
-    Format = format_status(opts_ignored, [pdict, State]),
+    Format = format_status([pdict, State]),
     ?assertEqual("http://h1/d1/";, proplists:get_value(source, Format)),
     ?assertEqual("http://h2/d2/";, proplists:get_value(target, Format)),
     ?assertEqual({"base", "+ext"}, proplists:get_value(rep_id, Format)),
diff --git a/src/couch_replicator/src/couch_replicator_worker.erl 
b/src/couch_replicator/src/couch_replicator_worker.erl
index 078e6e7e0..2d2da02c1 100644
--- a/src/couch_replicator/src/couch_replicator_worker.erl
+++ b/src/couch_replicator/src/couch_replicator_worker.erl
@@ -19,7 +19,7 @@
 % gen_server callbacks
 -export([init/1]).
 -export([handle_call/3, handle_cast/2, handle_info/2]).
--export([format_status/2]).
+-export([format_status/1]).
 
 -include_lib("couch/include/couch_db.hrl").
 -include_lib("couch_replicator/include/couch_replicator_api_wrap.hrl").
@@ -242,7 +242,7 @@ handle_info({'EXIT', _Pid, {doc_write_failed, _} = Err}, 
State) ->
 handle_info({'EXIT', Pid, Reason}, State) ->
     {stop, {process_died, Pid, Reason}, State}.
 
-format_status(_Opt, [_PDict, State]) ->
+format_status([_PDict, State]) ->
     #state{
         cp = MainJobPid,
         loop = LoopPid,
@@ -742,7 +742,7 @@ replication_worker_format_status_test() ->
         pending_fetch = nil,
         batch = #batch{size = 5}
     },
-    Format = format_status(opts_ignored, [pdict, State]),
+    Format = format_status([pdict, State]),
     ?assertEqual(self(), proplists:get_value(main_pid, Format)),
     ?assertEqual(self(), proplists:get_value(loop, Format)),
     ?assertEqual("http://u:*****@h/d1";, proplists:get_value(source, Format)),

Reply via email to