From 4ea778db2bf033bed2f391f719fc11b39b3dbeba Mon Sep 17 00:00:00 2001 From: Matthew Sackman Date: Fri, 14 Jan 2011 19:05:28 +0000 Subject: Rearrangement in gc. Can't seem to get it shorter than this though --- src/rabbit_msg_store_gc.erl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/rabbit_msg_store_gc.erl') diff --git a/src/rabbit_msg_store_gc.erl b/src/rabbit_msg_store_gc.erl index 7cf5c1f9..68bf4338 100644 --- a/src/rabbit_msg_store_gc.erl +++ b/src/rabbit_msg_store_gc.erl @@ -137,16 +137,17 @@ attempt_action(Action, Files, msg_store_state = MsgStoreState }) -> case [File || File <- Files, rabbit_msg_store:has_readers(File, MsgStoreState)] of - [] -> Thunks1 = - [do_action(Action, Files, MsgStoreState) | Thunks], - State #state { on_action = run_thunks(Thunks1) }; - [File | _] -> Pending1 = dict:store(File, {Action, Files}, Pending), - State #state { pending_no_readers = Pending1 } + [] -> + Thunks1 = lists:filter( + fun (Thunk) -> not Thunk() end, + [do_action(Action, Files, MsgStoreState) | Thunks]), + State #state { on_action = Thunks1 }; + [File | _] -> + Pending1 = dict:store(File, {Action, Files}, Pending), + State #state { pending_no_readers = Pending1 } end. do_action(combine, [Source, Destination], MsgStoreState) -> rabbit_msg_store:combine_files(Source, Destination, MsgStoreState); do_action(delete, [File], MsgStoreState) -> rabbit_msg_store:delete_file(File, MsgStoreState). - -run_thunks(Thunks) -> lists:filter(fun (Thunk) -> not Thunk() end, Thunks). -- cgit v1.2.1