Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/khepri_cluster.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1560,11 +1560,9 @@ get_store_ids() ->
is_store_running(StoreId) ->
ThisNode = node(),
RaServer = khepri_cluster:node_to_member(StoreId, ThisNode),
Runs = case ra:ping(RaServer, khepri_app:get_default_timeout()) of
{pong, _} -> true;
{error, _} -> false;
timeout -> false
end,
Timeout = khepri_app:get_default_timeout(),
KeyMetrics = ra:key_metrics(RaServer, Timeout),
Runs = maps:get(state, KeyMetrics) =/= noproc,

%% We know the real state of the Ra server. In the case the Ra server
%% stopped behind the back of Khepri, we update the cached list of running
Expand All @@ -1575,6 +1573,10 @@ is_store_running(StoreId) ->
ok;
false when not Runs ->
ok;
false when Runs ->
%% This function was called between the start of the Ra server and
%% the record of its configuration. This is a race, but that's ok.
ok;
true when not Runs ->
?LOG_DEBUG(
"Ra server for store ~s stopped behind the back of Khepri",
Expand Down