diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2011-04-08 18:10:19 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2011-04-08 18:10:19 +0100 |
commit | ab9625d32692ff221a449d3952a911e840ffa944 (patch) | |
tree | 632a37800d36e676e7116059902fd129ed920fd4 | |
parent | 16d52ee78e6924f4631edae6b9b0221efcd1d918 (diff) | |
download | rabbitmq-server-ab9625d32692ff221a449d3952a911e840ffa944.tar.gz |
Don't cons inside the tx, prevents us from copying the accumulator on the way into the worker pool at great cost.
-rw-r--r-- | src/rabbit_misc.erl | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 85e08615..814a5bbc 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -467,17 +467,20 @@ map_in_order(F, L) -> %% We ignore entries that have been modified or removed. table_filter(Pred, PrePostCommitFun, TableName) -> lists:foldl( - fun (E, Acc) -> execute_mnesia_transaction( - fun () -> case mnesia:match_object(TableName, E, - read) of - [] -> false; - _ -> Pred(E) - end - end, - fun (false, _Tx) -> Acc; - (true, Tx) -> PrePostCommitFun(E, Tx), - [E | Acc] - end) + fun (E, Acc) -> case execute_mnesia_transaction( + fun () -> case mnesia:match_object(TableName, E, + read) of + [] -> false; + _ -> Pred(E) + end + end, + fun (false, _Tx) -> false; + (true, Tx) -> PrePostCommitFun(E, Tx), + true + end) of + false -> Acc; + true -> [E | Acc] + end end, [], dirty_read_all(TableName)). dirty_read_all(TableName) -> |