Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix function return on emqx_hook:run('message.publish') #5

Merged
merged 1 commit into from
Sep 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/emqx_delayed_publish.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
load() ->
emqx:hook('message.publish', {?MODULE, on_message_publish, []}).

on_message_publish(Msg = #message{id = Id, topic = <<"$delay/", Topic/binary>>, timestamp = Ts}) ->
on_message_publish(Msg = #message{id = Id, topic = <<"$delayed/", Topic/binary>>, timestamp = Ts}) ->
[Delay, Topic1] = binary:split(Topic, <<"/">>),
PubAt = case binary_to_integer(Delay) of
Interval when Interval < ?MAX_INTERVAL ->
Expand All @@ -59,8 +59,8 @@ on_message_publish(Msg = #message{id = Id, topic = <<"$delay/", Topic/binary>>,
ok = store(#delayed_message{key = {PubAt, delayed_mid(Id)}, msg = PubMsg}),
{stop, PubMsg};

on_message_publish(_Msg) ->
ok.
on_message_publish(Msg) ->
{ok, Msg}.

delayed_mid(undefined) ->
emqx_guid:gen();
Expand Down