diff options
| author | Diana Corbacho <diana.corbacho@erlang-solutions.com> | 2016-06-21 08:17:49 +0100 |
|---|---|---|
| committer | Diana Corbacho <diana.corbacho@erlang-solutions.com> | 2016-06-21 08:23:00 +0100 |
| commit | 5f1ffc6b2834aca32674121ed723e6b7e632a54e (patch) | |
| tree | 3e730490e7e966074d9558eeab0f67f180f21e8b /src | |
| parent | 81ff300a43640acd7a6c36f2dc31a73f8dc05bb2 (diff) | |
| download | rabbitmq-server-git-5f1ffc6b2834aca32674121ed723e6b7e632a54e.tar.gz | |
Priority queues: retrieve max priority from state in invoke
Neither amqqueue_process, master or slave modules are aware of
the priority data expected by this function, it must be stored
and retrieved internal.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_priority_queue.erl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rabbit_priority_queue.erl b/src/rabbit_priority_queue.erl index ae8a38daf0..0d75753be6 100644 --- a/src/rabbit_priority_queue.erl +++ b/src/rabbit_priority_queue.erl @@ -43,7 +43,7 @@ info/2, invoke/3, is_duplicate/2, set_queue_mode/2, zip_msgs_and_acks/4]). --record(state, {bq, bqss}). +-record(state, {bq, bqss, max_priority}). -record(passthrough, {bq, bqs}). %% See 'note on suffixes' below @@ -157,7 +157,8 @@ init(Q, Recover, AsyncCallback) -> [{P, Init(P, Term)} || {P, Term} <- PsTerms] end, #state{bq = BQ, - bqss = BQSs} + bqss = BQSs, + max_priority = hd(Ps)} end. %% [0] collapse_recovery has the effect of making a list of recovery %% terms in priority order, even for non priority queues. It's easier @@ -417,7 +418,7 @@ info(Item, #state{bq = BQ, bqss = BQSs}) -> info(Item, #passthrough{bq = BQ, bqs = BQS}) -> BQ:info(Item, BQS). -invoke(Mod, {P, Fun}, State = #state{bq = BQ}) -> +invoke(Mod, Fun, State = #state{bq = BQ, max_priority = P}) -> pick1(fun (_P, BQSN) -> BQ:invoke(Mod, Fun, BQSN) end, P, State); invoke(Mod, Fun, State = #passthrough{bq = BQ, bqs = BQS}) -> ?passthrough1(invoke(Mod, Fun, BQS)). |
