diff options
| author | Matthew Sackman <matthew@lshift.net> | 2009-10-12 12:22:16 +0100 |
|---|---|---|
| committer | Matthew Sackman <matthew@lshift.net> | 2009-10-12 12:22:16 +0100 |
| commit | aa704e71a575555b69036acaa58b79b9c79665d9 (patch) | |
| tree | b22988d3a4c6143f70a73c6e48815704f74358b9 | |
| parent | cbdf3da7c001844eb3cbb1dfb3d512e87172793e (diff) | |
| download | rabbitmq-server-git-aa704e71a575555b69036acaa58b79b9c79665d9.tar.gz | |
a couple of full list sorts were unnecessary and should only have been max or mins
| -rw-r--r-- | src/rabbit_queue_index.erl | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl index 98ab2d7787..18cea92a11 100644 --- a/src/rabbit_queue_index.erl +++ b/src/rabbit_queue_index.erl @@ -318,17 +318,18 @@ find_lowest_seq_id_seg_and_highest_seq_id(Dir) -> %% that's fine. The important thing is that the segment exists and %% the seq_id reported is on a segment boundary. LowSeqIdSeg = - case lists:sort(SegNumsPaths) of + case SegNumsPaths of [] -> 0; - [{SegNum1, _SegPath1}|_] -> reconstruct_seq_id(SegNum1, 0) + _ -> {SegNum1, _SegPath1} = lists:min(SegNumsPaths), + reconstruct_seq_id(SegNum1, 0) end, HighestSeqId = - case rev_sort(SegNumsPaths) of + case SegNumsPaths of [] -> 0; - [{SegNum2, SegPath2}|_] -> - {_SDict, _AckCount, HighRelSeq} = - load_segment(SegNum2, SegPath2, dict:new()), - reconstruct_seq_id(SegNum2, HighRelSeq) + _ -> {SegNum2, SegPath2} = lists:max(SegNumsPaths), + {_SDict, _AckCount, HighRelSeq} = + load_segment(SegNum2, SegPath2, dict:new()), + reconstruct_seq_id(SegNum2, HighRelSeq) end, {LowSeqIdSeg, HighestSeqId}. |
