summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2010-10-11 18:25:59 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2010-10-11 18:25:59 +0100
commitfb1ad09099eaf67302667b6cbb3c34931ab542f6 (patch)
tree5ffee6764cc8b78262a946cf0d489967ab50629a
parentcb0d4edbd28354dbdcf081fb17b44d3d904c75cb (diff)
downloadrabbitmq-server-git-fb1ad09099eaf67302667b6cbb3c34931ab542f6.tar.gz
sets are faster than gb_sets
-rw-r--r--src/rabbit_amqqueue_process.erl3
-rw-r--r--src/rabbit_queue_collector.erl11
2 files changed, 6 insertions, 8 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index dc5b0fd12a..19db731a2f 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -858,8 +858,7 @@ handle_cast({reject, AckTags, Requeue, ChPid},
handle_cast({rollback, Txn, ChPid}, State) ->
noreply(rollback_transaction(Txn, ChPid, State));
-handle_cast(delete_immediately,
- State = #q{ q = #amqqueue{exclusive_owner = Owner}}) ->
+handle_cast(delete_immediately, State) ->
{stop, normal, State};
handle_cast({unblock, ChPid}, State) ->
diff --git a/src/rabbit_queue_collector.erl b/src/rabbit_queue_collector.erl
index 9d8757a770..f0534b9afd 100644
--- a/src/rabbit_queue_collector.erl
+++ b/src/rabbit_queue_collector.erl
@@ -82,8 +82,7 @@ handle_call(delete_all, _From, State = #state{queues = Queues}) ->
fun () -> ok end,
fun () -> rabbit_amqqueue:delete_immediately(Q) end)
|| {_MRef, Q} <- Qs],
- {reply, ok, wait_DOWNs(gb_sets:from_list([MRef || {MRef, _Q} <- Qs]),
- State)}.
+ {reply, ok, wait_DOWNs(sets:from_list([MRef || {MRef, _Q} <- Qs]), State)}.
handle_cast(Msg, State) ->
{stop, {unhandled_cast, Msg}, State}.
@@ -99,11 +98,11 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
wait_DOWNs(MRefs, State) ->
- case gb_sets:is_empty(MRefs) of
- true -> State;
- false -> receive
+ case sets:size(MRefs) of
+ 0 -> State;
+ _ -> receive
{'DOWN', MRef, process, _DownPid, _Reason} ->
- wait_DOWNs(gb_sets:del_element(MRef, MRefs),
+ wait_DOWNs(sets:del_element(MRef, MRefs),
erase_queue(MRef, State))
end
end.