diff options
| author | Matthias Radestock <matthias@lshift.net> | 2010-05-18 19:27:26 +0100 |
|---|---|---|
| committer | Matthias Radestock <matthias@lshift.net> | 2010-05-18 19:27:26 +0100 |
| commit | bbe80f0ae6b869f542caa6def142d707a0ded5bc (patch) | |
| tree | efefba7ebde18e122175c9dfec6c850cb69bcd96 /src | |
| parent | 957d2ed75f29a22258937cecd9ea03c3a07c817a (diff) | |
| download | rabbitmq-server-git-bbe80f0ae6b869f542caa6def142d707a0ded5bc.tar.gz | |
minor refactor
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_queue_index.erl | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl index df28bb2d6f..f245172583 100644 --- a/src/rabbit_queue_index.erl +++ b/src/rabbit_queue_index.erl @@ -571,22 +571,22 @@ add_to_journal(RelSeq, Action, %% This is a more relaxed version of deliver_or_ack_msg because we can %% have dels or acks in the journal without the corresponding -%% pub. Also, always want to keep acks. Things must occur in the right -%% order though. -add_to_journal(RelSeq, Action, SegJArray) -> - case array:get(RelSeq, SegJArray) of - undefined -> - array:set(RelSeq, - case Action of - {_Msg, _IsPersistent} -> {Action, no_del, no_ack}; - del -> {no_pub, del, no_ack}; - ack -> {no_pub, no_del, ack} - end, SegJArray); - ({Pub, no_del, no_ack}) when Action == del -> - array:set(RelSeq, {Pub, del, no_ack}, SegJArray); - ({Pub, Del, no_ack}) when Action == ack -> - array:set(RelSeq, {Pub, Del, ack}, SegJArray) - end. +%% pub. Also, always want to keep ack'd entries. Things must occur in +%% the right order though. +add_to_journal(RelSeq, Action, JEntries) -> + Val = case array:get(RelSeq, JEntries) of + undefined -> + case Action of + ?PUB -> {Action, no_del, no_ack}; + del -> {no_pub, del, no_ack}; + ack -> {no_pub, no_del, ack} + end; + ({Pub, no_del, no_ack}) when Action == del -> + {Pub, del, no_ack}; + ({Pub, Del, no_ack}) when Action == ack -> + {Pub, Del, ack} + end, + array:set(RelSeq, Val, JEntries). maybe_flush_journal(State = #qistate { dirty_count = DCount }) when DCount > ?MAX_JOURNAL_ENTRY_COUNT -> |
