Merge pull request #12524 from emqx/fix/bridge-stop-snabbkaffe
test(bridge_mqtt): Stop snabbkaffe servers
This commit is contained in:
commit
b7f3f48d38
|
@ -1,5 +1,5 @@
|
|||
%%--------------------------------------------------------------------
|
||||
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||
%% Copyright (c) 2023-2024 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||
%%
|
||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||
%% you may not use this file except in compliance with the License.
|
||||
|
@ -77,6 +77,7 @@ init_per_testcase(TestCase, Config) ->
|
|||
].
|
||||
|
||||
end_per_testcase(_TestCase, _Config) ->
|
||||
snabbkaffe:stop(),
|
||||
emqx_common_test_helpers:call_janitor(),
|
||||
emqx_bridge_v2_testlib:delete_all_bridges_and_connectors(),
|
||||
ok.
|
||||
|
|
|
@ -90,7 +90,7 @@ init([DB, Shard]) ->
|
|||
process_flag(trap_exit, true),
|
||||
process_flag(message_queue_data, off_heap),
|
||||
%% TODO: adjust leader dynamically
|
||||
{ok, Leader} = emqx_ds_replication_layer_meta:shard_leader(DB, Shard),
|
||||
Leader = shard_leader(DB, Shard),
|
||||
S = #s{
|
||||
db = DB,
|
||||
shard = Shard,
|
||||
|
@ -173,3 +173,13 @@ do_enqueue(From, Sync, Msg, S0 = #s{n = N, batch = Batch, pending_replies = Repl
|
|||
start_timer() ->
|
||||
Interval = application:get_env(emqx_durable_storage, egress_flush_interval, 100),
|
||||
erlang:send_after(Interval, self(), ?flush).
|
||||
|
||||
shard_leader(DB, Shard) ->
|
||||
%% TODO: use optvar
|
||||
case emqx_ds_replication_layer_meta:shard_leader(DB, Shard) of
|
||||
{ok, Leader} ->
|
||||
Leader;
|
||||
{error, no_leader_for_shard} ->
|
||||
timer:sleep(500),
|
||||
shard_leader(DB, Shard)
|
||||
end.
|
||||
|
|
Loading…
Reference in New Issue