Skip to content

Commit bd51857

Browse files
author
Nicola Turato
committed
moved memory checks into maybeStopConsumer
1 parent 74b63c0 commit bd51857

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

RabbitMq/BatchConsumer.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ public function execute(AMQPMessage $msg)
8585
$this->addMessage($msg);
8686

8787
$this->maybeStopConsumer();
88-
89-
if (null !== $this->getMemoryLimit() && $this->isRamAlmostOverloaded()) {
90-
$this->stopConsuming();
91-
}
9288
}
9389

9490
public function consume()
@@ -189,10 +185,6 @@ protected function handleProcessMessages($processFlags = null)
189185

190186
$this->consumed++;
191187
$this->maybeStopConsumer();
192-
193-
if (null !== $this->getMemoryLimit() && $this->isRamAlmostOverloaded()) {
194-
$this->stopConsuming();
195-
}
196188
}
197189

198190
/**
@@ -390,6 +382,10 @@ protected function maybeStopConsumer()
390382
if ($this->forceStop) {
391383
$this->stopConsuming();
392384
}
385+
386+
if (null !== $this->getMemoryLimit() && $this->isRamAlmostOverloaded()) {
387+
$this->stopConsuming();
388+
}
393389
}
394390

395391
/**

0 commit comments

Comments
 (0)