summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2012-02-14 18:09:56 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2012-02-14 18:09:56 +0000
commit12f50e7fd4cf1e8f9f545dc297ba92c8b7b42aab (patch)
tree7f235166153431863a7a51cb69b31fc7d267cc2a
parent2214ba8f1ccdea454797ec2f0a0dea2ddef51398 (diff)
downloadrabbitmq-server-git-12f50e7fd4cf1e8f9f545dc297ba92c8b7b42aab.tar.gz
cosmetic
-rw-r--r--src/rabbit_amqqueue_process.erl42
-rw-r--r--src/rabbit_variable_queue.erl10
2 files changed, 24 insertions, 28 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index e308447f5a..298025048d 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -229,24 +229,24 @@ bq_init(BQ, Q, Recover) ->
end).
process_args(State = #q{q = #amqqueue{arguments = Arguments}}) ->
- lists:foldl(fun({Arg, Fun}, State1) ->
- case rabbit_misc:table_lookup(Arguments, Arg) of
- {_Type, Val} -> Fun(Val, State1);
- undefined -> State1
- end
- end, State, [{<<"x-expires">>, fun init_expires/2},
- {<<"x-message-ttl">>, fun init_ttl/2},
- {<<"x-dead-letter-exchange">>, fun init_dlx/2},
- {<<"x-dead-letter-routing-key">>,
- fun init_dlx_routing_key/2}]).
+ lists:foldl(
+ fun({Arg, Fun}, State1) ->
+ case rabbit_misc:table_lookup(Arguments, Arg) of
+ {_Type, Val} -> Fun(Val, State1);
+ undefined -> State1
+ end
+ end, State,
+ [{<<"x-expires">>, fun init_expires/2},
+ {<<"x-message-ttl">>, fun init_ttl/2},
+ {<<"x-dead-letter-exchange">>, fun init_dlx/2},
+ {<<"x-dead-letter-routing-key">>, fun init_dlx_routing_key/2}]).
init_expires(Expires, State) -> ensure_expiry_timer(State#q{expires = Expires}).
init_ttl(TTL, State) -> drop_expired_messages(State#q{ttl = TTL}).
-init_dlx(DLX, State = #q{q = #amqqueue{name = #resource{
- virtual_host = VHostPath}}}) ->
- State#q{dlx = rabbit_misc:r(VHostPath, exchange, DLX)}.
+init_dlx(DLX, State = #q{q = #amqqueue{name = QName}}) ->
+ State#q{dlx = rabbit_misc:r(QName, exchange, DLX)}.
init_dlx_routing_key(RoutingKey, State) ->
State#q{dlx_routing_key = RoutingKey}.
@@ -1229,12 +1229,9 @@ handle_call({delete, IfUnused, IfEmpty}, From,
IsEmpty = BQ:is_empty(BQS),
IsUnused = is_unused(State),
if
- IfEmpty and not(IsEmpty) ->
- reply({error, not_empty}, State);
- IfUnused and not(IsUnused) ->
- reply({error, in_use}, State);
- true ->
- dead_letter_deleted_queue(From, State)
+ IfEmpty and not(IsEmpty) -> reply({error, not_empty}, State);
+ IfUnused and not(IsUnused) -> reply({error, in_use}, State);
+ true -> dead_letter_deleted_queue(From, State)
end;
handle_call(purge, _From, State = #q{backing_queue = BQ,
@@ -1245,10 +1242,9 @@ handle_call(purge, _From, State = #q{backing_queue = BQ,
handle_call(purge, From, State = #q{backing_queue = BQ,
backing_queue_state = BQS}) ->
- BQS1 = BQ:dropwhile(
- fun (_) -> true end,
- mk_dead_letter_fun(queue_purged, State),
- BQS),
+ BQS1 = BQ:dropwhile(fun (_) -> true end,
+ mk_dead_letter_fun(queue_purged, State),
+ BQS),
case BQ:len(BQS) of
0 -> reply({ok, 0}, State#q{backing_queue_state = BQS1});
_ -> noreply(
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index a4a2d655cb..38436b94cc 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -648,11 +648,11 @@ ack(AckTags, undefined, State) ->
ack_out_counter = AckOutCount + length(AckTags) })};
ack(AckTags, MsgFun, State = #vqstate{pending_ack = PA}) ->
- State2 = lists:foldl(fun(SeqId, State1) ->
- AckEntry = gb_trees:get(SeqId, PA),
- MsgFun(read_msg_callback(AckEntry), SeqId, State1)
- end, State, AckTags),
- {[], State2}.
+ {[], lists:foldl(
+ fun(SeqId, State1) ->
+ AckEntry = gb_trees:get(SeqId, PA),
+ MsgFun(read_msg_callback(AckEntry), SeqId, State1)
+ end, State, AckTags)}.
requeue(AckTags, #vqstate { delta = Delta,
q3 = Q3,