Delay receive waiting time
This commit is contained in:
parent
a95ebcd7d6
commit
d020ac0390
|
@ -72,7 +72,7 @@ publish(_) ->
|
||||||
ok = emqx:subscribe(<<"test/+">>),
|
ok = emqx:subscribe(<<"test/+">>),
|
||||||
timer:sleep(10),
|
timer:sleep(10),
|
||||||
emqx:publish(Msg),
|
emqx:publish(Msg),
|
||||||
?assert(receive {dispatch, <<"test/+">>, #message{payload = <<"hello">>}} -> true after 5 -> false end).
|
?assert(receive {dispatch, <<"test/+">>, #message{payload = <<"hello">>}} -> true after 100 -> false end).
|
||||||
|
|
||||||
dispatch_with_no_sub(_) ->
|
dispatch_with_no_sub(_) ->
|
||||||
Msg = emqx_message:make(ct, <<"no_subscribers">>, <<"hello">>),
|
Msg = emqx_message:make(ct, <<"no_subscribers">>, <<"hello">>),
|
||||||
|
@ -98,7 +98,7 @@ pubsub(_) ->
|
||||||
true;
|
true;
|
||||||
P ->
|
P ->
|
||||||
ct:log("Receive Message: ~p~n",[P])
|
ct:log("Receive Message: ~p~n",[P])
|
||||||
after 2 ->
|
after 100 ->
|
||||||
false
|
false
|
||||||
end),
|
end),
|
||||||
spawn(fun() ->
|
spawn(fun() ->
|
||||||
|
@ -124,14 +124,14 @@ t_shared_subscribe(_) ->
|
||||||
emqx:subscribe(<<"a/#">>),
|
emqx:subscribe(<<"a/#">>),
|
||||||
timer:sleep(10),
|
timer:sleep(10),
|
||||||
emqx:publish(emqx_message:make(ct, <<"a/b/c">>, <<"hello">>)),
|
emqx:publish(emqx_message:make(ct, <<"a/b/c">>, <<"hello">>)),
|
||||||
?assert(receive {dispatch, <<"a/#">>, _} -> true after 2 -> false end),
|
?assert(receive {dispatch, <<"a/#">>, _} -> true after 100 -> false end),
|
||||||
emqx:unsubscribe(<<"a/#">>).
|
emqx:unsubscribe(<<"a/#">>).
|
||||||
|
|
||||||
'pubsub+'(_) ->
|
'pubsub+'(_) ->
|
||||||
emqx:subscribe(<<"a/+/+">>),
|
emqx:subscribe(<<"a/+/+">>),
|
||||||
timer:sleep(10),
|
timer:sleep(10),
|
||||||
emqx:publish(emqx_message:make(ct, <<"a/b/c">>, <<"hello">>)),
|
emqx:publish(emqx_message:make(ct, <<"a/b/c">>, <<"hello">>)),
|
||||||
?assert(receive {dispatch, <<"a/+/+">>, _} -> true after 1 -> false end),
|
?assert(receive {dispatch, <<"a/+/+">>, _} -> true after 100 -> false end),
|
||||||
emqx:unsubscribe(<<"a/+/+">>).
|
emqx:unsubscribe(<<"a/+/+">>).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
|
@ -63,7 +63,7 @@ receive_messages(Count, Msgs) ->
|
||||||
receive_messages(Count-1, [Msg|Msgs]);
|
receive_messages(Count-1, [Msg|Msgs]);
|
||||||
_Other ->
|
_Other ->
|
||||||
receive_messages(Count, Msgs)
|
receive_messages(Count, Msgs)
|
||||||
after 10 ->
|
after 100 ->
|
||||||
Msgs
|
Msgs
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue