Permalink
Browse files

fix the bug: handle empty priority list while no user(consumer) alive.

  • Loading branch information...
1 parent 1445c73 commit 73dee88e96843edef52eed7c792e4709ff4a7c7d @ericliang committed Dec 21, 2010
Showing with 11 additions and 7 deletions.
  1. +11 −7 src/mod_rabbitmq_consumer.erl
View
18 src/mod_rabbitmq_consumer.erl
@@ -128,13 +128,17 @@ handle_cast({deliver, _ConsumerTag, false, {_QName, QPid, _Id, _Redelivered, Msg
#basic_message{exchange_name = #resource{name = XNameBin},
routing_key = RKBin,
content = #content{payload_fragments_rev = PayloadRev}} = Msg,
- [{_, {TopPriorityJID, _}} | _] = Priorities,
- send_message(jlib:make_jid(binary_to_list(XNameBin),
- State#state.lserver,
- binary_to_list(RKBin)),
- TopPriorityJID,
- "chat",
- binary_to_list(list_to_binary(lists:reverse(PayloadRev)))),
+ case Priorities of
+ [] ->
+ ok;
+ [{_, {TopPriorityJID, _}} | _] ->
+ send_message(jlib:make_jid(binary_to_list(XNameBin),
+ State#state.lserver,
+ binary_to_list(RKBin)),
+ TopPriorityJID,
+ "chat",
+ binary_to_list(list_to_binary(lists:reverse(PayloadRev))))
+ end,
case mod_rabbitmq_util:call(rabbit_amqqueue, notify_sent, [QPid, self()]) of
{error, Reason1} ->
?ERROR_MSG("mod_rabbitmq_util:call error in ~p~n~p~n",

0 comments on commit 73dee88

Please sign in to comment.