diff options
| author | Matthias Radestock <matthias@lshift.net> | 2008-09-26 20:53:11 +0100 |
|---|---|---|
| committer | Matthias Radestock <matthias@lshift.net> | 2008-09-26 20:53:11 +0100 |
| commit | 5f36cce3cc7715fed3d6073e56367fbda0ca75a1 (patch) | |
| tree | d32e25a9619f39112bbb57da77d12adef82085fa /src | |
| parent | 61d7ddfec0915c22a502a8eba27ac71071ca958d (diff) | |
| download | rabbitmq-server-git-5f36cce3cc7715fed3d6073e56367fbda0ca75a1.tar.gz | |
more simplifications
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_exchange.erl | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl index c500f19573..9d8aef906c 100644 --- a/src/rabbit_exchange.erl +++ b/src/rabbit_exchange.erl @@ -201,15 +201,16 @@ simple_publish(Mandatory, Immediate, % % TODO: This returns a list of QPids to route to. % Maybe this should be handled by a cursor instead. -% This routes directly to queues, avoiding any lookup of routes route(#exchange{name = Name, type = topic}, RoutingKey) -> - Query = qlc:q([QName || #route{binding = #binding{exchange_name = ExchangeName, - queue_name = QName, - key = BindingKey}} <- mnesia:table(route), - ExchangeName == Name, - % TODO: This causes a full scan for each entry - % with the same exchange (see bug 19336) - topic_matches(BindingKey, RoutingKey)]), + Query = qlc:q([QName || + #route{binding = #binding{ + exchange_name = ExchangeName, + queue_name = QName, + key = BindingKey}} <- mnesia:table(route), + ExchangeName == Name, + %% TODO: This causes a full scan for each entry + %% with the same exchange (see bug 19336) + topic_matches(BindingKey, RoutingKey)]), lookup_qpids(mnesia:async_dirty(fun qlc:e/1, [Query])); route(#exchange{name = Name}, RoutingKey) -> @@ -219,12 +220,11 @@ route(#exchange{name = Name}, RoutingKey) -> lookup_qpids(mnesia:dirty_select(route, [{MatchHead, [], ['$1']}])). lookup_qpids(Queues) -> - mnesia:async_dirty( - fun sets:fold/3, - [fun(Key, Acc) -> - [#amqqueue{pid = QPid}] = mnesia:read({amqqueue, Key}), - [QPid | Acc] - end, [], sets:from_list(Queues)]). + sets:fold( + fun(Key, Acc) -> + [#amqqueue{pid = QPid}] = mnesia:dirty_read({amqqueue, Key}), + [QPid | Acc] + end, [], sets:from_list(Queues)). % TODO: Should all of the route and binding management not be refactored to it's own module % Especially seeing as unbind will have to be implemented for 0.91 ? |
