diff options
| author | Matthew Sackman <matthew@lshift.net> | 2009-10-12 11:05:44 +0100 |
|---|---|---|
| committer | Matthew Sackman <matthew@lshift.net> | 2009-10-12 11:05:44 +0100 |
| commit | ab00b22f45feb9643a5efd22b87b488a927bd46f (patch) | |
| tree | 89d31d55188f6e9af27e21dedb833b29ed9be1ca /src | |
| parent | 78bbcafeff1f0abc713bc195ff12f81dc9adde34 (diff) | |
| download | rabbitmq-server-git-ab00b22f45feb9643a5efd22b87b488a927bd46f.tar.gz | |
given the way in which the vq works, the removed tests were unnecessary. For example, in store_alpha, q1 *must* be empty unless one of q2, gamma and q3 is non empty. As such, to determine whether the alpha goes to q4, we only need to test for emptiness of q2, gamma and q3, not q1 aswell. Similar logic holds for store_beta
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_variable_queue.erl | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index b0bfd8cdf6..41ad77917e 100644 --- a/src/rabbit_variable_queue.erl +++ b/src/rabbit_variable_queue.erl @@ -87,11 +87,11 @@ %% on disk at that stage (msg on disk, index on disk). %% %% When a msg arrives, we decide in which form it should be. It is -%% then added to the rightmost appropriate queue, maintaining +%% then added to the right-most appropriate queue, maintaining %% order. Thus if the msg is to be an alpha, it will be added to q1, -%% unless all of q1, q2, gamma and q3 are empty, in which case it will -%% go to q4. If it is to be a beta, it will be added to q2 unless all -%% of q2 and gamma are empty, in which case it will go to q3. +%% unless all of q2, gamma and q3 are empty, in which case it will go +%% to q4. If it is to be a beta, it will be added to q2 unless gamma +%% is empty, in which case it will go to q3. %% %% The major invariant is that if the msg is to be a beta, q1 will be %% empty, and if it is to be a gamma then both q1 and q2 will be empty. @@ -528,8 +528,8 @@ store_alpha_entry(Entry = #alpha {}, State = #vqstate { q1 = Q1, q2 = Q2, gamma = #gamma { count = GammaCount }, q3 = Q3, q4 = Q4 }) -> - case queue:is_empty(Q1) andalso queue:is_empty(Q2) andalso - GammaCount == 0 andalso queue:is_empty(Q3) of + case queue:is_empty(Q2) andalso GammaCount == 0 andalso queue:is_empty(Q3) + of true -> State #vqstate { q4 = queue:in(Entry, Q4) }; false -> @@ -539,7 +539,7 @@ store_alpha_entry(Entry = #alpha {}, State = store_beta_entry(Entry = #beta {}, State = #vqstate { q2 = Q2, gamma = #gamma { count = GammaCount }, q3 = Q3 }) -> - case queue:is_empty(Q2) andalso GammaCount == 0 of + case GammaCount == 0 of true -> State #vqstate { q3 = queue:in(Entry, Q3) }; false -> State #vqstate { q2 = queue:in(Entry, Q2) } end. |
