diff options
| author | Daniil Fedotov <dfedotov@pivotal.io> | 2017-04-19 15:36:43 +0100 |
|---|---|---|
| committer | Daniil Fedotov <dfedotov@pivotal.io> | 2017-04-19 15:36:43 +0100 |
| commit | ae6e4227f48339fd10f44252532e3de774871d0d (patch) | |
| tree | cb124e39afedc35efdf36a1e66b1d35608dccece /src | |
| parent | 0ee51b1bbb44800edd7b3c2e0b7204fab54f96b4 (diff) | |
| download | rabbitmq-server-git-ae6e4227f48339fd10f44252532e3de774871d0d.tar.gz | |
Replace dicts with maps in message store GC
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_msg_store_gc.erl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/rabbit_msg_store_gc.erl b/src/rabbit_msg_store_gc.erl index 6179ef95bb..728c9652d0 100644 --- a/src/rabbit_msg_store_gc.erl +++ b/src/rabbit_msg_store_gc.erl @@ -70,7 +70,7 @@ set_maximum_since_use(Pid, Age) -> init([MsgStoreState]) -> ok = file_handle_cache:register_callback(?MODULE, set_maximum_since_use, [self()]), - {ok, #state { pending_no_readers = dict:new(), + {ok, #state { pending_no_readers = #{}, on_action = [], msg_store_state = MsgStoreState }, hibernate, {backoff, ?HIBERNATE_AFTER_MIN, ?HIBERNATE_AFTER_MIN, ?DESIRED_HIBERNATE}}. @@ -89,11 +89,11 @@ handle_cast({delete, File}, State) -> handle_cast({no_readers, File}, State = #state { pending_no_readers = Pending }) -> - {noreply, case dict:find(File, Pending) of + {noreply, case maps:find(File, Pending) of error -> State; {ok, {Action, Files}} -> - Pending1 = dict:erase(File, Pending), + Pending1 = maps:remove(File, Pending), attempt_action( Action, Files, State #state { pending_no_readers = Pending1 }) @@ -123,7 +123,7 @@ attempt_action(Action, Files, fun (Thunk) -> not Thunk() end, [do_action(Action, Files, MsgStoreState) | Thunks]) }; - [File | _] -> Pending1 = dict:store(File, {Action, Files}, Pending), + [File | _] -> Pending1 = maps:put(File, {Action, Files}, Pending), State #state { pending_no_readers = Pending1 } end. |
