summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2009-06-17 13:18:15 +0100
committerMatthew Sackman <matthew@lshift.net>2009-06-17 13:18:15 +0100
commit6a6356582c923c3b408bbd34a73a33e72b76f328 (patch)
treeed9f806636f2fb7e294fdcc9db3b1119de997052
parentcd3312a50493218168fa26349023c9935d52292e (diff)
downloadrabbitmq-server-6a6356582c923c3b408bbd34a73a33e72b76f328.tar.gz
post case/if discussion
-rw-r--r--src/rabbit_disk_queue.erl15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/rabbit_disk_queue.erl b/src/rabbit_disk_queue.erl
index 87c7abc9..eeb6896a 100644
--- a/src/rabbit_disk_queue.erl
+++ b/src/rabbit_disk_queue.erl
@@ -654,11 +654,10 @@ get_read_handle(File, State =
current_file_handle = CurHdl,
current_dirty = IsDirty
}) ->
- IsDirty2 = case CurName of
- File when IsDirty ->
+ IsDirty2 = if CurName =:= File andalso IsDirty ->
file:sync(CurHdl),
false;
- _ -> IsDirty
+ true -> IsDirty
end,
Now = now(),
{FileHdl, ReadHdls1, ReadHdlsAge1} =
@@ -840,11 +839,10 @@ internal_tx_publish(MsgId, MsgBody,
ets:lookup(FileSummary, CurName),
ValidTotalSize1 = ValidTotalSize + TotalSize +
?FILE_PACKING_ADJUSTMENT,
- ContiguousTop1 = case CurOffset of
- ContiguousTop ->
+ ContiguousTop1 = if CurOffset =:= ContiguousTop ->
%% can't be any holes in this file
ValidTotalSize1;
- _ -> ContiguousTop
+ true -> ContiguousTop
end,
true = ets:insert(FileSummary, {CurName, ValidTotalSize1,
ContiguousTop1, Left, undefined}),
@@ -1222,11 +1220,10 @@ combine_files({Source, SourceValid, _SourceContiguousTop,
%% the DestinationContiguousTop to a tmp file then truncate,
%% copy back in, and then copy over from Source
%% otherwise we just truncate straight away and copy over from Source
- case DestinationContiguousTop of
- DestinationValid ->
+ if DestinationContiguousTop =:= DestinationValid ->
ok = truncate_and_extend_file(DestinationHdl,
DestinationValid, ExpectedSize);
- _ ->
+ true ->
Tmp = filename:rootname(Destination) ++ ?FILE_EXTENSION_TMP,
{ok, TmpHdl} =
file:open(form_filename(Tmp),