Skip to content

Commit 90a556e

Browse files
jackbaylisstegos
authored andcommitted
[12.x] Use null coalescing for memoryExceededExitCode (laravel#57090)
* Update Worker.php * Update Worker.php * Update Worker.php * use 0
1 parent 60beaa2 commit 90a556e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Illuminate/Queue/Worker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ protected function stopIfNecessary(WorkerOptions $options, $lastRestart, $startT
314314
{
315315
return match (true) {
316316
$this->shouldQuit => static::EXIT_SUCCESS,
317-
$this->memoryExceeded($options->memory) => static::$memoryExceededExitCode ?: static::EXIT_MEMORY_LIMIT,
317+
$this->memoryExceeded($options->memory) => static::$memoryExceededExitCode ?? static::EXIT_MEMORY_LIMIT,
318318
$this->queueShouldRestart($lastRestart) => static::EXIT_SUCCESS,
319319
$options->stopWhenEmpty && is_null($job) => static::EXIT_SUCCESS,
320320
$options->maxTime && hrtime(true) / 1e9 - $startTime >= $options->maxTime => static::EXIT_SUCCESS,

tests/Integration/Queue/WorkCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ public function testMemoryExitCode()
167167
{
168168
$this->markTestSkippedWhenUsingQueueDrivers(['redis', 'beanstalkd']);
169169

170-
Worker::$memoryExceededExitCode = 25;
170+
Worker::$memoryExceededExitCode = 0;
171171

172172
Queue::push(new FirstJob);
173173
Queue::push(new SecondJob);
174174

175175
$this->artisan('queue:work', [
176176
'--memory' => 0.1,
177-
])->assertExitCode(25);
177+
])->assertExitCode(0);
178178

179179
// Memory limit isn't checked until after the first job is attempted.
180180
$this->assertSame(1, Queue::size());

0 commit comments

Comments
 (0)