diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2014-01-10 12:05:41 +0000 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2014-01-10 12:05:41 +0000 |
commit | da9a64c595090c72157f65b27ea889d25f9c6e9c (patch) | |
tree | b9f8359744dbe7eac131a6e007cfcba07c756cc6 | |
parent | 5afcb260bcf40622f1c3ea7b395a23dc8de5220a (diff) | |
download | rabbitmq-server-bug25938.tar.gz |
revert most of http://hg.rabbitmq.com/rabbitmq-server/rev/5fddc5198854bug25938
since it was wrong. except for the var renaming in r_queue_consumer:add.
-rw-r--r-- | src/rabbit_limiter.erl | 10 | ||||
-rw-r--r-- | src/rabbit_queue_consumers.erl | 4 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/rabbit_limiter.erl b/src/rabbit_limiter.erl index c33b3c74..d5cfbce6 100644 --- a/src/rabbit_limiter.erl +++ b/src/rabbit_limiter.erl @@ -126,7 +126,7 @@ get_prefetch_limit/1, ack/2, pid/1]). %% queue API -export([client/1, activate/1, can_send/3, resume/1, deactivate/1, - is_suspended/1, is_consumer_blocked/2, credit/5, drained/1, + is_suspended/1, is_consumer_blocked/2, credit/4, drained/1, forget_consumer/2]). %% callbacks -export([init/1, terminate/2, code_change/3, handle_call/3, handle_cast/2, @@ -168,8 +168,8 @@ -spec(deactivate/1 :: (qstate()) -> qstate()). -spec(is_suspended/1 :: (qstate()) -> boolean()). -spec(is_consumer_blocked/2 :: (qstate(), rabbit_types:ctag()) -> boolean()). --spec(credit/5 :: (qstate(), rabbit_types:ctag(), non_neg_integer(), boolean(), - boolean()) -> qstate()). +-spec(credit/4 :: (qstate(), rabbit_types:ctag(), non_neg_integer(), boolean()) + -> qstate()). -spec(drained/1 :: (qstate()) -> {[{rabbit_types:ctag(), non_neg_integer()}], qstate()}). -spec(forget_consumer/2 :: (qstate(), rabbit_types:ctag()) -> qstate()). @@ -276,9 +276,7 @@ is_consumer_blocked(#qstate{credits = Credits}, CTag) -> {value, #credit{}} -> true end. -credit(Limiter = #qstate{credits = Credits}, CTag, _Credit, true, true) -> - Limiter#qstate{credits = update_credit(CTag, 0, true, Credits)}; -credit(Limiter = #qstate{credits = Credits}, CTag, Credit, _IsEmpty, Drain) -> +credit(Limiter = #qstate{credits = Credits}, CTag, Credit, Drain) -> Limiter#qstate{credits = update_credit(CTag, Credit, Drain, Credits)}. drained(Limiter = #qstate{credits = Credits}) -> diff --git a/src/rabbit_queue_consumers.erl b/src/rabbit_queue_consumers.erl index ab235755..0a823366 100644 --- a/src/rabbit_queue_consumers.erl +++ b/src/rabbit_queue_consumers.erl @@ -131,7 +131,7 @@ add(ChPid, ConsumerTag, NoAck, LimiterPid, LimiterActive, CreditArgs, OtherArgs, Limiter2 = case CreditArgs of none -> Limiter1; {Crd, Drain} -> rabbit_limiter:credit( - Limiter1, ConsumerTag, Crd, IsEmpty, Drain) + Limiter1, ConsumerTag, Crd, Drain) end, C1 = C#cr{consumer_count = Count + 1, limiter = Limiter2}, @@ -312,7 +312,7 @@ credit(IsEmpty, Credit, Drain, ChPid, CTag, State) -> unchanged; #cr{limiter = Limiter} = C -> C1 = C#cr{limiter = rabbit_limiter:credit( - Limiter, CTag, Credit, IsEmpty, Drain)}, + Limiter, CTag, Credit, Drain)}, C2 = #cr{limiter = Limiter1} = case Drain andalso IsEmpty of true -> send_drained(C1); |