Delay receive waiting time

This commit is contained in:
Gilbert Wong 2019-03-17 00:34:45 +08:00 committed by Gilbert
parent a95ebcd7d6
commit d020ac0390
2 changed files with 5 additions and 5 deletions

View File

@ -72,7 +72,7 @@ publish(_) ->
ok = emqx:subscribe(<<"test/+">>),
timer:sleep(10),
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(_) ->
Msg = emqx_message:make(ct, <<"no_subscribers">>, <<"hello">>),
@ -98,7 +98,7 @@ pubsub(_) ->
true;
P ->
ct:log("Receive Message: ~p~n",[P])
after 2 ->
after 100 ->
false
end),
spawn(fun() ->
@ -124,14 +124,14 @@ t_shared_subscribe(_) ->
emqx:subscribe(<<"a/#">>),
timer:sleep(10),
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/#">>).
'pubsub+'(_) ->
emqx:subscribe(<<"a/+/+">>),
timer:sleep(10),
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/+/+">>).
%%--------------------------------------------------------------------

View File

@ -63,7 +63,7 @@ receive_messages(Count, Msgs) ->
receive_messages(Count-1, [Msg|Msgs]);
_Other ->
receive_messages(Count, Msgs)
after 10 ->
after 100 ->
Msgs
end.