Skip to content

Commit

Permalink
Fix function return on emqx_hook:run('message.publish')
Browse files Browse the repository at this point in the history
  • Loading branch information
huangdan authored and tigercl committed Sep 29, 2018
1 parent b3ddfcd commit 78963df
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/emqx_delayed_publish.erl
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

0 comments on commit 78963df

Please sign in to comment.