Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4: (31 commits)
  [Messenger] Add call to `gc_collect_cycles()` after each message is handled
  fix tests
  fix tests on AppVeyor
  Hungarian typo fix in validators translation
  [VarDump] Fix order of dumped properties - parent goes first
  DX: drop unused import
  [Validator] updated Latvian translation
  re-introduce conflict rule with WebProfilerBundle < 6.4
  [Validator] Added missing Swedish translations
  [Mailer] [Notifier] #52264 Update Sendinblue / Brevo API host
  [Validator] Added missing Estonian translations #51939
  fix File constraint tests on 32bit PHP
  [Form] Skip merging params & files if there are no files in the first place
  [Translation] Ignore bridges in `.gitattributes` file
  [AssetMapper] Adding import-parsing case where import contains a path
  Add missing Hungarian validator translations
  Added missing Bosnian translations #51929
  add return type hints to EntityFactory
  Update UndefinedCallableHandler with "importmap", "form" and "worflow" filters/functions
  [FrameworkBundle] Fix CommandDataCollector is always registered
  ...
  • Loading branch information
xabbuh committed Oct 25, 2023
2 parents 12e9482 + a035441 commit e76c794
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Tests/WorkerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,25 @@ public function testFlushBatchOnStop()

$this->assertSame($expectedMessages, $handler->processedMessages);
}

public function testGcCollectCyclesIsCalledOnMessageHandle()
{
$apiMessage = new DummyMessage('API');

$receiver = new DummyReceiver([[new Envelope($apiMessage)]]);

$bus = $this->createMock(MessageBusInterface::class);

$dispatcher = new EventDispatcher();
$dispatcher->addSubscriber(new StopWorkerOnMessageLimitListener(1));

$worker = new Worker(['transport' => $receiver], $bus, $dispatcher);
$worker->run();

$gcStatus = gc_status();

$this->assertGreaterThan(0, $gcStatus['runs']);
}
}

class DummyReceiver implements ReceiverInterface
Expand Down
2 changes: 2 additions & 0 deletions Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public function run(array $options = []): void
// this should prevent multiple lower priority receivers from
// blocking too long before the higher priority are checked
if ($envelopeHandled) {
gc_collect_cycles();

break;
}
}
Expand Down

0 comments on commit e76c794

Please sign in to comment.