summaryrefslogtreecommitdiff
path: root/cpp/lib/broker/BrokerQueue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/lib/broker/BrokerQueue.cpp')
-rw-r--r--cpp/lib/broker/BrokerQueue.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/cpp/lib/broker/BrokerQueue.cpp b/cpp/lib/broker/BrokerQueue.cpp
index a8c5343ca3..bfea1918a4 100644
--- a/cpp/lib/broker/BrokerQueue.cpp
+++ b/cpp/lib/broker/BrokerQueue.cpp
@@ -161,14 +161,19 @@ u_int32_t Queue::purge(){
}
void Queue::pop(){
- if (policy.get()) policy->dequeued(messages.front(), store);
+ if (policy.get()) policy->dequeued(messages.front()->contentSize());
messages.pop();
}
void Queue::push(Message::shared_ptr& msg){
queueing = true;
messages.push(msg);
- if (policy.get()) policy->enqueued(messages.front(), store);
+ if (policy.get()) {
+ policy->enqueued(msg->contentSize());
+ if (policy->limitExceeded()) {
+ msg->releaseContent(store);
+ }
+ }
}
u_int32_t Queue::getMessageCount() const{