diff --git a/Core/src/Batch/BatchJob.php b/Core/src/Batch/BatchJob.php index 05b5535f3e88..6da598290e47 100644 --- a/Core/src/Batch/BatchJob.php +++ b/Core/src/Batch/BatchJob.php @@ -106,6 +106,9 @@ public function run() $q = msg_get_queue($sysvKey); $items = []; $lastInvoked = microtime(true); + $maxSize = is_array($stat = @msg_stat_queue($q)) && isset($stat['msg_qbytes']) + ? $stat['msg_qbytes'] + : 8192; if (!is_null($this->bootstrapFile)) { require_once($this->bootstrapFile); @@ -118,7 +121,7 @@ public function run() $q, 0, $type, - 8192, + $maxSize, $message, true, 0, // blocking mode diff --git a/Core/tests/Unit/Batch/SysvProcessorTest.php b/Core/tests/Unit/Batch/SysvProcessorTest.php index bcaa13f920e7..d70a751e673a 100644 --- a/Core/tests/Unit/Batch/SysvProcessorTest.php +++ b/Core/tests/Unit/Batch/SysvProcessorTest.php @@ -193,11 +193,15 @@ private function send($message, $type = null) private function receive(&$type, &$message, &$errorcode, $unserialize = false) { + $maxSize = is_array($stat = @msg_stat_queue($this->queue)) && isset($stat['msg_qbytes']) + ? $stat['msg_qbytes'] + : 8192; + return @msg_receive( $this->queue, 0, $type, - 8192, + $maxSize, $message, $unserialize, MSG_IPC_NOWAIT,