diff options
| author | Matthew Sackman <matthew@lshift.net> | 2009-12-15 17:43:03 +0000 |
|---|---|---|
| committer | Matthew Sackman <matthew@lshift.net> | 2009-12-15 17:43:03 +0000 |
| commit | c150ac5ca0ed6c57b8f59c95103e8877ccd12073 (patch) | |
| tree | 5b505fe9d077196f020938dd0cee35484a26430a | |
| parent | be240e47b20c631e50b394a888e7eb785c278e36 (diff) | |
| download | rabbitmq-server-git-c150ac5ca0ed6c57b8f59c95103e8877ccd12073.tar.gz | |
Don't reverse the entire list, only to pull off one element
| -rw-r--r-- | src/rabbit_msg_store.erl | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl index c21e4bd9da..798e9d655f 100644 --- a/src/rabbit_msg_store.erl +++ b/src/rabbit_msg_store.erl @@ -792,11 +792,12 @@ build_index(Files, State) -> build_index(Left, [], FilesToCompact, State) -> ok = index_delete_by_file(undefined, State), - Offset = case lists:reverse(index_search_by_file(Left, State)) of - [] -> 0; - [#msg_location { offset = MaxOffset, - total_size = TotalSize } | _] -> - MaxOffset + TotalSize + Offset = case index_search_by_file(Left, State) of + [] -> 0; + List -> #msg_location { offset = MaxOffset, + total_size = TotalSize } = + lists:last(List), + MaxOffset + TotalSize end, {Offset, compact(FilesToCompact, %% this never includes the current file State #msstate { current_file = Left })}; |
