Skip to content

Commit

Permalink
fix: Fix flaky t_core_node_down testcase
Browse files Browse the repository at this point in the history
Fixes: emqx#113
  • Loading branch information
ieQu1 committed Jun 22, 2023
1 parent 587ef50 commit b268f36
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/mria_shards_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,15 @@ find_shard(Shard) ->
-spec start_shard(mria_rlog:shard()) -> {ok, pid()}
| {error, _}.
start_shard(Shard) ->
Child = shard_sup(Shard),
supervisor:start_child(?SUPERVISOR, Child).
case whereis(?SUPERVISOR) of
undefined ->
%% FIXME: communicate via CVAR instead
timer:sleep(100),
start_shard(Shard);
_Pid ->
Child = shard_sup(Shard),
supervisor:start_child(?SUPERVISOR, Child)
end.

%% @doc Restart a shard
-spec restart_shard(mria_rlog:shard(), _Reason) -> ok.
Expand Down

0 comments on commit b268f36

Please sign in to comment.