diff options
| -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 e4691b81d0..d67c30a38d 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 %%---------------------------------------------------------------------------- |
