diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2022-04-04 19:35:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-04 19:35:22 +0300 |
commit | faf6e2704249ca36a5df910f959ed3e912a6731a (patch) | |
tree | fa3013bb0ae1fa72a7c2fe8a8778bd10d547d8bf /config | |
parent | dd5b4ffbb9fe1d0f30ec2ab54112d475923e0006 (diff) |
Try to reduce failed cache write random UI test failures (#19040)
* try to avoid random filesystem cache write failure during UI tests by retrying
* update ui-test.php
* forgot return
Diffstat (limited to 'config')
-rw-r--r-- | config/environment/ui-test.php | 25 | ||||
-rw-r--r-- | config/global.php | 2 |
2 files changed, 27 insertions, 0 deletions
diff --git a/config/environment/ui-test.php b/config/environment/ui-test.php index 49126b20b6..9373ffb8b4 100644 --- a/config/environment/ui-test.php +++ b/config/environment/ui-test.php @@ -10,6 +10,31 @@ return array( 'tests.ui.url_normalizer_blacklist.api' => array(), 'tests.ui.url_normalizer_blacklist.controller' => array(), + 'twig.cache' => function (\Psr\Container\ContainerInterface $container) { + $templatesPath = $container->get('path.tmp.templates'); + return new class($templatesPath) extends \Twig\Cache\FilesystemCache { + public function write(string $key, string $content): void + { + $retryCount = 3; + + $attempts = 0; + while ($attempts < $retryCount) { + try { + parent::write($key, $content); + return; + } catch (\Exception $ex) { + if (!preg_match('/^Failed to write cache file/', $ex->getMessage())) { + throw $ex; + } + + usleep(50); + ++$attempts; + } + } + } + }; + }, + 'Piwik\Config' => \DI\decorate(function (\Piwik\Config $config) { $config->General['cors_domains'][] = '*'; $config->General['trusted_hosts'][] = '127.0.0.1'; diff --git a/config/global.php b/config/global.php index 1e43a2e479..d93adad66f 100644 --- a/config/global.php +++ b/config/global.php @@ -35,6 +35,8 @@ return array( 'view.clearcompiledtemplates.enable' => true, + 'twig.cache' => DI\string('path.tmp.templates'), + 'Matomo\Cache\Eager' => function (ContainerInterface $c) { $backend = $c->get('Matomo\Cache\Backend'); $cacheId = $c->get('cache.eager.cache_id'); |