Skip to content

Commit c08a3fc

Browse files
committed
ACP2E-4246: Merged js files are not properly generated on projects with many stores.
1 parent 6e13440 commit c08a3fc

File tree

1 file changed

+23
-4
lines changed
  • lib/internal/Magento/Framework/View/Asset

1 file changed

+23
-4
lines changed

lib/internal/Magento/Framework/View/Asset/File.php

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717
class File implements MergeableInterface
1818
{
19+
private const MAX_READ_ATTEMPTS = 3;
20+
1921
/**
2022
* @var string
2123
*/
@@ -183,13 +185,30 @@ public function getSourceContentType()
183185
*/
184186
public function getContent()
185187
{
186-
$content = $this->source->getContent($this);
187-
if (false === $content) {
188-
throw new File\NotFoundException("Unable to get content for '{$this->getPath()}'");
188+
$attempt = 0;
189+
while ($attempt < self::MAX_READ_ATTEMPTS) {
190+
$attempt++;
191+
$content = trim($this->source->getContent($this));
192+
193+
if ($content) {
194+
return $content;
195+
}
196+
197+
if ($attempt < self::MAX_READ_ATTEMPTS) {
198+
usleep(random_int(10000, 1000000));
199+
}
189200
}
190-
return $content;
201+
202+
throw new File\NotFoundException(
203+
sprintf(
204+
"Unable to get content for '%s' after %d attempts.",
205+
$this->getPath(),
206+
self::MAX_READ_ATTEMPTS
207+
)
208+
);
191209
}
192210

211+
193212
/**
194213
* @inheritdoc
195214
*/

0 commit comments

Comments
 (0)