File tree Expand file tree Collapse file tree 1 file changed +23
-4
lines changed
lib/internal/Magento/Framework/View/Asset Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Original file line number Diff line number Diff line change 1616 */
1717class 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 */
You can’t perform that action at this time.
0 commit comments