Open SteffenAnders opened 3 years ago
ping @weierophinney 😄
Any updates here? @weierophinney
@michalbundyra @froschdesign
@SteffenAnders
After deploying and publishing a new version of our application… … Or is there a way to generate the cache files via CLI before the actual release of the website (See: #5)?
Have you tried to create a CLI command and perform an HTTP request?
Hi guys,
i have just updated
laminas/laminas-modulemanager
from 2.8.4 to 2.10.1.Our
application.config.php
looks like this:After deploying and publishing a new version of our application, several hundred requests immediately call up the website. And every one of these requests wants to generate the cache files of the application, because they do not exist initially.
With the old version of
laminas/laminas-modulemanager
(2.8.4) there were usually some warnings which was caused by a write conflict of multiplerename()
calls for the same filepath. But that was OK for me, because after a few seconds the warnings disappeared and the website was still usable from the beginning.The warnings looked like this:
But since the new version of
laminas/laminas-modulemanager
(2.10.1) real exceptions instead of warnings are thrown in this case. This results in the website not being callable for up to 30 seconds, because apparently several requests or processes are blocking each other,The exceptions look like this:
I think it has something to do with the changes of the following pull request: https://github.com/laminas/laminas-modulemanager/pull/9
It is nice that the new "SafeWriter" now ensures that no broken cache files will be generated. However, the problem with multiple requests trying to write the same file at the same time is still present and even worse than before due to the throwing excpetions instead of ignorable warnings.
What can we do to avoid the problem? Is there a try..catch possibility, so that in case of a "SafeWriter" exception the cache generation will simply be skipped, because the file was already generated by an other process?
Or is there a way to generate the cache files via CLI before the actual release of the website (See: https://github.com/laminas/laminas-modulemanager/issues/5)?
In the meantime we are using the old version 2.8.4. :)