diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2011-10-15 12:25:23 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2011-10-15 12:25:23 +0100 |
commit | 95294ae2cad14081b1163ed6461609c6f58c18d8 (patch) | |
tree | 86fde751ffd991cd21253fe1c18009c5c05729d5 /src/rabbit_msg_store.erl | |
parent | 733185ced5e283a7beabf122e5d4ff826f29158a (diff) | |
download | rabbitmq-server-95294ae2cad14081b1163ed6461609c6f58c18d8.tar.gz |
a spot of inlining
Diffstat (limited to 'src/rabbit_msg_store.erl')
-rw-r--r-- | src/rabbit_msg_store.erl | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl index e4691b81..d67c30a3 100644 --- a/src/rabbit_msg_store.erl +++ b/src/rabbit_msg_store.erl @@ -1069,8 +1069,13 @@ safe_ets_update_counter(Tab, Key, UpdateOp, SuccessFun, FailThunk) -> catch error:badarg -> FailThunk() end. -safe_ets_update_counter_ok(Tab, Key, UpdateOp, FailThunk) -> - safe_ets_update_counter(Tab, Key, UpdateOp, fun (_) -> ok end, FailThunk). +update_msg_cache(CacheEts, MsgId, Msg) -> + case ets:insert_new(CacheEts, {MsgId, Msg, 1}) of + true -> ok; + false -> safe_ets_update_counter( + CacheEts, MsgId, {3, +1}, fun (_) -> ok end, + fun () -> update_msg_cache(CacheEts, MsgId, Msg) end) + end. adjust_valid_total_size(File, Delta, State = #msstate { sum_valid_data = SumValid, @@ -1257,18 +1262,6 @@ list_sorted_file_names(Dir, Ext) -> filelib:wildcard("*" ++ Ext, Dir)). %%---------------------------------------------------------------------------- -%% message cache helper functions -%%---------------------------------------------------------------------------- - -update_msg_cache(CacheEts, MsgId, Msg) -> - case ets:insert_new(CacheEts, {MsgId, Msg, 1}) of - true -> ok; - false -> safe_ets_update_counter_ok( - CacheEts, MsgId, {3, +1}, - fun () -> update_msg_cache(CacheEts, MsgId, Msg) end) - end. - -%%---------------------------------------------------------------------------- %% index %%---------------------------------------------------------------------------- |