Skip to content

Commit fb778a9

Browse files
authored
MCLOUD-5563: Add information about warm-up concurrency into log (magento#773)
1 parent 2c8d2b7 commit fb778a9

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/Step/PostDeploy/WarmUp.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,21 @@ public function __construct(
6767
public function execute()
6868
{
6969
try {
70-
$this->logger->info('Starting page warming up');
70+
$this->logger->info('Starting page warmup');
7171
$config = [];
7272

73+
$concurrency = $this->postDeploy->get(PostDeployInterface::VAR_WARM_UP_CONCURRENCY);
74+
if ($concurrency) {
75+
$config['concurrency'] = $concurrency;
76+
$this->logger->info(
77+
sprintf(
78+
'Warmup concurrency set to %s as specified by the %s configuration',
79+
$concurrency,
80+
PostDeployInterface::VAR_WARM_UP_CONCURRENCY
81+
)
82+
);
83+
}
84+
7385
$urls = $this->urls->getAll();
7486

7587
$config['fulfilled'] = function ($response, $index) use ($urls) {
@@ -95,11 +107,6 @@ public function execute()
95107
$this->logger->error('Warming up failed: ' . $urls[$index], $context);
96108
};
97109

98-
$concurrency = $this->postDeploy->get(PostDeployInterface::VAR_WARM_UP_CONCURRENCY);
99-
if ($concurrency) {
100-
$config['concurrency'] = $concurrency;
101-
}
102-
103110
$pool = $this->poolFactory->create($urls, $config);
104111

105112
/** @var PromiseInterface $promise */

src/Test/Unit/Step/PostDeploy/WarmUpTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,14 @@ public function testExecuteWithConcurrency()
185185
];
186186
$concurrency = 2;
187187

188+
$this->loggerMock->expects($this->any())
189+
->method('info')
190+
->withConsecutive(
191+
['Starting page warmup'],
192+
['Warmup concurrency set to ' . $concurrency . ' as specified by the '
193+
. PostDeployInterface::VAR_WARM_UP_CONCURRENCY . ' configuration']
194+
);
195+
188196
$this->urlsMock->method('getAll')
189197
->willReturn($urls);
190198
$this->postDeployMock->method('get')

0 commit comments

Comments
 (0)