You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2024/08/20 00:49:04 UTC
(couchdb) 01/02: Use extract_delta for delta message handling
This is an automated email from the ASF dual-hosted git repository.
chewbranca pushed a commit to branch couch-stats-resource-tracker-v2
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit d2c7eba12c11302ebbfb9a2793f8df24cb322810
Author: Russell Branca <ch...@apache.org>
AuthorDate: Mon Aug 19 17:47:59 2024 -0700
Use extract_delta for delta message handling
---
src/fabric/src/fabric_util.erl | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/fabric/src/fabric_util.erl b/src/fabric/src/fabric_util.erl
index 63c70e270..19804e949 100644
--- a/src/fabric/src/fabric_util.erl
+++ b/src/fabric/src/fabric_util.erl
@@ -137,19 +137,20 @@ get_shard([#shard{node = Node, name = Name} | Rest], Opts, Timeout, Factor) ->
Ref = rexi:cast(Node, self(), MFA, [sync]),
try
receive
- {Ref, {ok, Db}} ->
- {ok, Db};
- %% TODO: switch to using rexi_utils:extract_delta
- {Ref, {ok, Db}, {delta, Delta}} ->
+ Msg0 ->
+ {Msg, Delta} = rexi_utils:extract_delta(Msg0),
couch_stats_resource_tracker:accumulate_delta(Delta),
- {ok, Db};
- {Ref, {'rexi_EXIT', {{unauthorized, _} = Error, _}}} ->
- throw(Error);
- {Ref, {'rexi_EXIT', {{forbidden, _} = Error, _}}} ->
- throw(Error);
- {Ref, Reason} ->
- couch_log:debug("Failed to open shard ~p because: ~p", [Name, Reason]),
- get_shard(Rest, Opts, Timeout, Factor)
+ case Msg of
+ {Ref, {ok, Db}} ->
+ {ok, Db};
+ {Ref, {'rexi_EXIT', {{unauthorized, _} = Error, _}}} ->
+ throw(Error);
+ {Ref, {'rexi_EXIT', {{forbidden, _} = Error, _}}} ->
+ throw(Error);
+ {Ref, Reason} ->
+ couch_log:debug("Failed to open shard ~p because: ~p", [Name, Reason]),
+ get_shard(Rest, Opts, Timeout, Factor)
+ end
after Timeout ->
couch_log:debug("Failed to open shard ~p after: ~p", [Name, Timeout]),
get_shard(Rest, Opts, Factor * Timeout, Factor)