nette / robot-loader

🍀 RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.
https://doc.nette.org/robotloader
Other
871 stars 32 forks source link

Bug fix: problem with concurrency under stress #34

Open chrisgraham opened 7 months ago

chrisgraham commented 7 months ago

This adds additional configurability to RobotLoader, to minimize unnecessary cache rewrites during stress. This reduces the chance of concurrency problems.

dg commented 2 days ago

Wouldn't it be better to set setAutoRefresh(false) in this case ?

chrisgraham commented 17 hours ago

In a development environment it's expected that new classes may appear, so auto refresh is needed. But on the same development environment, PHPStan aggressively creates cache files as PHP code. Other environments could have similar issues as it is fairly common for PHP files to be used for caching systems. I believe my PR provides a pretty modest solution to that, just making things a bit more configurable. (Looking at it now I can see somehow it got noisy with other commits, so just look at the ones I did please.)